Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-19-2007, 11:23 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Created a DM for Reputation - one problem though...

I created a datamanager for Reputation. I had to do this so I could give reputation for something which pertains to a custom mod i'm working on. Basically to summarize, whenever a member submits feedback, the feedback is rated by a moderator and given a score. The member then receives the same amount of feedback as the score.

I added the column 'scstfbid' to the reputation table, therefore reputation.scstfbid holds the id of the feedback report for which the reputation is given.

Naturally since the reputation given isn't for a post, the value inserted into the column for reputation.postid is '0'.

The problem which arises however is that by default, the reputation table has an index named whoadded_postid. This index is built off the columns `whoadded` and `postid`. The index type however is that of unique, which makes sense (since reputation can only be given to any specific post by a specific user no more than once).

My problem is that in my custom mod, the post id is filled with a value of '0' when reputation is given for a feedback report, therefore if any moderator gives reputation for more than 1 feedback report, the mysql engind returns the following error:

MySQL Error : Duplicate entry '1-0' for key 2
Error Number : 1062


Because (when giving reputation for feedback), the post id is entered as '0'.

I know that I could change the type of the index from unique to normal and my problem would likely go away, however it's likely that would screw up some of the default functionality of vbulletin, wouldn't it?

Does anyone have an idea of how to work around this issue? it's been stumping me for the entire day...
Attached Files
File Type: php class_dm_screputation.php (3.3 KB, 3 views)
Reply With Quote
  #2  
Old 08-20-2007, 06:27 AM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Antivirus View Post
MySQL Error : Duplicate entry '1-0' for key 2
Error Number : 1062


Because (when giving reputation for feedback), the post id is entered as '0'.

I know that I could change the type of the index from unique to normal and my problem would likely go away, however it's likely that would screw up some of the default functionality of vbulletin, wouldn't it?

Does anyone have an idea of how to work around this issue? it's been stumping me for the entire day...
It would screw up the functionality, vb uses an insert ignore statement for reputation entries, which means new rows which violate the unique condition do not get entered.

There is no work around with the schema you are using. I suggest creating an entirely new table for your feedback reputation
Reply With Quote
  #3  
Old 08-20-2007, 02:10 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ugh... I didn't want to do that! I guess i'm running out of options here.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:42 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03342 seconds
  • Memory Usage 2,199KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (1)postbit_attachment
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete