openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

minor like count issue #100

Closed moui72 closed 3 years ago

moui72 commented 7 years ago

if I go from the index page (i.e. http://openlabdev.org/webwork-playground/) to a question view (e.g. http://openlabdev.org/webwork-playground/#:problemId=local/CoordinatePlaneTrig/six-trig-point-q1.pg:questionId=11457) and then like (or have already liked during previous session) and then use browser back to return to index, there will be 1 more like than is correct, but refresh fixes.

to be clear:

Item 1 is liked by user A User A sees 1 like on index for item 1 User A navigates to question view for item 1 User A sees 1 like on question view for item 1 User A uses browser back button to return to index User A sees 2 likes for item 1 User A refreshes User A sees 1 like on index view for item 1

from @boonebgorges

It works this way because when you submit a like, the like count changes by incrementing/decrementing the count from the original pageload, not by returning an updated count from the browser. This can be changed, but it's not trivial because of the way the application currently differentiates between overall like counts and the like status of the logged-in user. Perhaps you could open a ticket against a future milestone that describes this?

boonebgorges commented 4 years ago

I've rewritten this logic so that counts are no longer incremented server-side, but instead the true count is returned from the server on successful up/down vote. This should resolve the problem.

bree-z commented 3 years ago

This looks good, thanks!