In some cases when voting by AJAX there is a considerable delay before voting results are returned. This may result when e.g. complex Voting API processing is done, as when Content Recommendation Engine data are being indexed.

The attached patch implements an approach taken in e.g. Views Bookmarks. Content is updated immediately so there is no delay for the user. I've retained the AJAX return data.

Approach:

* Pass string in Drupal.settings.
* Parse existing point total from the voting count message.
* Determine if user has voted previously by state of voting widget. If so, we need to increment or decrement the values by two, as user is reversing previous vote.

CommentFileSizeAuthor
vote_up_down-immediate.patch3.52 KBnedjo

Comments

patchak’s picture

I've applied this patch on my test site and the voting results does not appear as soon as the vote is casted. The arrow does not change color. If I do anything else like going to another page, the site throws an error as if the vote was not registered.

Funny thing is that if i refresh the same page, I see that the vote has actually been registered, so the vote seesm to be recorded but the display of the vote does not appear...

Is this patch still up to date with the code of the module, maybe it's a little outdated??

Patchak

marvil07’s picture

Status: Needs review » Closed (won't fix)

No more features to 5.x, please take a look to the update on the project page, now 5.x is not-really-maintained.