News:

Support the VirtueMart project and become a member

Main Menu

Vote edits increment vote count

Started by Dave Withnall, September 14, 2009, 15:03:57 PM

Previous topic - Next topic

Dave Withnall

Howdy,

I just noticed that if you edit a rating it will automatically increment the vote count & appends the vote to the list.
EG. If a product has 1 review of rating 3 and you then edit the review and update the vote to a 5 the product will now store 3 & 5  with a total score of 4 (rather than 5).
This behaviour, in my opinion, is incorrect as an edit is not a new vote.

I have created a patch for ps_reviews.php which alters the behaviour. With this patch an edit will remove an old vote and replace it with a new one and scores will be calculated based on the new vote list.

Regards,

Dave.


[attachment cleanup by admin]


aravot

The code generates the following error.

QuoteNotice: Undefined variable: votes_arr in /home/site/administrator/components/com_virtuemart/classes/ps_reviews.php on line 219

Warning: array_search() [function.array-search]: Wrong datatype for second argument in /home/site/administrator/components/com_virtuemart/classes/ps_reviews.php on line 219

Notice: Undefined variable: votes_arr in /home/site/administrator/components/com_virtuemart/classes/ps_reviews.php on line 220