Maybe I'm missing something but if i navigate to the config page at admin/config/search/votingapi it says ..

"The amount of time that must pass before two anonymous votes from the same computer are considered unique. Setting this to 'never' will eliminate most double-voting, but will make it impossible for multiple anonymous on the same computer (like internet cafe customers) from casting votes. "

but the option does not have a never option. just goes up in stages upto a week

Comments

kokrull created an issue. See original summary.

victorcpereira’s picture

Assigned: Unassigned » victorcpereira
victorcpereira’s picture

Actually, 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.

victorcpereira’s picture

Status: Active » Needs review
victorcpereira’s picture

Sorry, I found a bug in the previous patch.
Please, check out the following patch.

kokrull’s picture

Thanks. if/when I figure out how to apply it I'll give you a shout back

kokrull’s picture

Thanks. Options for 'immediately' and 'never' now show as expected.

Andre-B’s picture

In 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.

benjifisher’s picture

Title: Anonymous vote rollover » Anonymous vote rollover has no "Never" option
pene’s picture

The patch in the 5th comment is just a workaround, if I'm not mistaken. If not, will this patch be merged anytime?

daniel kulbe’s picture

The latest patch does not work with beta1 release, so I repatched the 8.x-dev version.

daniel kulbe’s picture

StatusFileSize
new2.03 KB

Actually 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.

daniel kulbe’s picture

Version: 8.x-3.0-alpha2 » 8.x-3.x-dev
kokrull’s picture

So the 'fix' is in current .dev and should be inclueded in the next alpha?

daniel kulbe’s picture

I only updated the target version of the issue, against which the patch #12 is applied.
The changes still need to be reviewed.

droddis’s picture

I 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

kokrull’s picture

Just 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

jmarcou’s picture

I 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.

kokrull’s picture

I meant to get intouch again as the patch no longer applys, glad its being looked at again. thanks

rbrandon’s picture

StatusFileSize
new526 bytes

I 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.

MakeLimeade’s picture

I 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.

tr’s picture

Title: Anonymous vote rollover has no "Never" option » Vote rollover settings are missing the "Never" option
Component: Miscellaneous » Code
Assigned: victorcpereira » Unassigned
StatusFileSize
new4.31 KB

This 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:

  1. The "Anonymous vote rollover" and "Registered user vote rollover" settings do not have a "Never" option in D8. This is because SettingsForm was never completely ported to D8. SettingsForm also has wrong documentation, coding standards problems, and a bad constructor. All these things need to be fixed - the port to D8 needs to be completed, we can't move on to bigger and better things until the settings are handled correctly. These fixes don't need discussion, they just need to be committed. #20 does part of this, not all of it.
  2. The "Anonymous vote rollover" and "Registered user vote rollover" settings DON'T DO ANYTHING. This is because the voting window functionality was not ported to D8. There are a variety of places and ways this can be done. #5 and #12 are both options, but not the only options. However, making this functionality work in D8 requires step 1) be completed first.
  3. The voting window functionality could be improved. This is the subject of #8 and #18. But we don't even have the functionality ported to D8 and working in D8 yet, so patches to improve it are premature. I think we first need to make it work exactly the same as in D7 at this point so that people can transition their sites from D7 to D8. Once we have a working D8 release that implements this functionality we can work on improving it.

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.

tr’s picture

Patch still applies and tests still pass ...

hkirsman’s picture

Status: Needs review » Reviewed & tested by the community
hkirsman’s picture

Works fine for me too. Using with Rate 2.x-dev branch. The extra fixes seem also nice.

kokrull’s picture

patch applies,.. never and immediately added, nice one thanks

pifagor’s picture

  • pifagor committed 90fa76d on 8.x-3.x authored by TR
    Issue #2791129 by Daniel Kulbe, victorcpereira, TR, rbrandon, kokrull,...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.