I am jumping the gun a little here.

I have created a patch for VotingAPI to save the previous vote value to the database. See #1880462: Keep track of the previous vote in the database.

I want to be able to use this value in the rules. I will attach a patch and a screen-shot.

Comments

istryker’s picture

Assigned: istryker » Unassigned
Status: Active » Needs review
StatusFileSize
new49.74 KB
new576 bytes

Attached is the patch and screenshot

istryker’s picture

Status: Needs review » Reviewed & tested by the community

@melissavdh created the identical patch over in VotingAPI #1880462: Keep track of the previous vote in the database comment #4. Changing this status to RTBC

mermemladeK’s picture

StatusFileSize
new33.08 KB

Hi iStryker,

I applied both patches but I do not get vote:previous-value as you can see in the png. Am I doing something wrong? Yes I ran the update script.

istryker’s picture

Ok I just double check this on a fresh install and it worked.

Drupal 7.19
Votingapi Git 7.x-2.x
Voting_rules Git 7.x-1.x
Rules 7.x-2.2

patch http://drupal.org/files/previous-vote-rule-1882086-1.patch from Comment #1
patch http://drupal.org/files/add_previous_vote-1880462-3.patch from #1880462: Keep track of the previous vote in the database

If this doesn't work, then I would rebuild Rules caching
http://-yoursite.com-/admin/config/workflow/rules/settings/advanced

mermemladeK’s picture

I rebuilt the Rules caching and yet nothing.
I went through the patched files and the code is there...

I'm using:
Voting API 7.x-2.10,
Voting Rules 7.x-1.0-alpha1
Rules 7.x-2.2.

I really wonder what's wrong.

istryker’s picture

Ok this might be the weirdest thing, I had problems testing it on Staging. Staging had APC caching on. I either waited 1 day, or turned it off, and everything work.

APC caches PHP files. Any change made to the file will not be seen until the cache is cleared. This is at the PHP layer, not the Drupal layer.

I also confirm this by copying voting_rules module to voting_rules2, with identical files (except all the functions were voting_rules2_... instead of voting_rules_... as well as the name of all the files) with the patch already in it and it worked right away.

mermemladeK’s picture

Hi iStryker,

My host is GreenGeeks and I don't think the problem is about APC caching.
Would you min attaching your patched files so that I can compare them with mines and see if there's anything different please?

Thank you

istryker’s picture

StatusFileSize
new2.58 KB

voting_rules2 tar file attached with previous value

mermemladeK’s picture

Hi iStryker,

It's working! Sorry for the inconveniences, I think it was my noobish skills than anything else. I used a clean downlaod for voting-rules and patched the files manually (I learnt that in the process), and now it works!

blogook’s picture

Works great for me too! I am giving my users points for voting, now that I can check against the previous value I also can check if the user is not voting twice :)

I am wondering though, if there will be an update for votingapi, what will happen with the patch?

thanks in advance