Closed (fixed)
Project:
Voting API
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Aug 2016 at 02:24 UTC
Updated:
23 Jul 2020 at 23:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
victorcpereira commentedComment #3
victorcpereira commentedActually, this setting was not implemented for D8 version.
I've implemented this setting in the Vote->save()
Before save a vote, I'm checking if there is a vote in the time window.
If there is, the previous vote is deleted and the new vote is saved.
Here's a patch.
Comment #4
victorcpereira commentedComment #5
victorcpereira commentedSorry, I found a bug in the previous patch.
Please, check out the following patch.
Comment #6
kokrull commentedThanks. if/when I figure out how to apply it I'll give you a shout back
Comment #7
kokrull commentedThanks. Options for 'immediately' and 'never' now show as expected.
Comment #8
Andre-BIn my opinion this setting is too granular to be applied on a global space. The setting can/ should be a default for widgets to act on. But enforcing the the same rollover configuration on all votes, vote types, fields is probably not a good idea. Imagine a website on which you have multiple votes with different rules when a vote shall be counted as a new vote, this couldn't be solved once this patch is in.
hotel booking and rating page. having hotel reviews be applied for a 2 week window for logged in users is a good idea - quality of accommodation can change over time / seasons. So counting reviews on the same hotel should be aggregated for a specific window. for a new season another vote count as a new vote. that way you can have nice analysis over time. on the same site rating another users uploaded images shall be enforced to never change. different field, maybe even different voting widget so we should have different configuration for both. https://www.drupal.org/project/votingapi_widgets has an example implementation on this.
Comment #9
benjifisherComment #10
pene commentedThe patch in the 5th comment is just a workaround, if I'm not mistaken. If not, will this patch be merged anytime?
Comment #11
daniel kulbeThe latest patch does not work with beta1 release, so I repatched the 8.x-dev version.
Comment #12
daniel kulbeActually the patch does not work as desired, saving a vote by votingapi_widgets is causing an Exception:
Update existing 'vote' entity while changing the ID is not supported.
So I moved the logic to the Vote::preSave() method.
Comment #13
daniel kulbeComment #14
kokrull commentedSo the 'fix' is in current .dev and should be inclueded in the next alpha?
Comment #15
daniel kulbeI only updated the target version of the issue, against which the patch #12 is applied.
The changes still need to be reviewed.
Comment #16
droddis commentedI seem to be struggling to get the patch from #12 to apply from the root of the votingapi folder. It's asking me what files to patch. Am I missing something in this?
*EDIT - you learn something new everyday.. adding in the -p1 to the patch command solved the issue.
patch -p1
Comment #17
kokrull commentedJust letting you know the patch still applys cleanly and have prob applied it to about 10 or so dev play sites. and one dist. all good
ps what does the patch '-p1' add? I just used the instructions here and never used the -p1, which is the correct way?
https://drupalize.me/videos/applying-and-creating-patches-git?p=1173
cheers and thanks
Comment #18
jmarcou commentedI created a new issue with a different approach : https://www.drupal.org/project/votingapi/issues/3060468
Instead of using the Vote::preSave method to prevent double-voting, I use the VoteStorage::getUserVotes method, which not only prevent the double-voting, but also retrieves the correct votes for the current user (relative to its source and the rollover window you choose), so you don't end up displaying vote from another user.
I also added the "Immediately" and "Never" options like here, but also added a new config to choose between different sources (ip, cookie, or ip + cookie), so developers have more options to work with it.
Comment #19
kokrull commentedI meant to get intouch again as the patch no longer applys, glad its being looked at again. thanks
Comment #20
rbrandon commentedI can see where @Andre-B is going above in #8 and it makes a certain amount of sense. Seeing as there has not been conscientious on this, here is a patch just to add the options like the title asks, allowing modules to use them how they like. This is needed especially since -1 is the default in the settings.
Comment #21
MakeLimeade commentedI just wanted to point out that the issue exists for Registered users in the Voting API settings too. There is no "Never" option there either, same as for anonymous users.
Comment #22
tr commentedThis issue has strayed pretty far from the original post. I don't think we're going to get anywhere unless we handle these issues separately. Bottom line is Voting API still has not been completely ported to D8.
There are three distinct issues here:
Attached is a patch for step 1). This step can be fixed now. Let's take this in steps and maybe we can finish porting this module to D8.
Comment #23
tr commentedPatch still applies and tests still pass ...
Comment #24
hkirsman commentedComment #25
hkirsman commentedWorks fine for me too. Using with Rate 2.x-dev branch. The extra fixes seem also nice.
Comment #26
kokrull commentedpatch applies,.. never and immediately added, nice one thanks
Comment #27
pifagorComment #29
pifagor