Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, I have a big problem with Views & VotingApi: (I'm using Extra Voting Forms module)
The average of 2 ratings 17 and 16 have a result of 17.0.5 instead of 16.5, why?
ex: node A
user1 rates node A 17
user2 rates node A 16
node A has an average result of 17.0.5 instead of 16.5
This is strange, doesn"t it?
ex average
11.6667 I've got this display: 12.0.6667
I don't know if it's a bug with EVF, or VotingAPI....
Comment | File | Size | Author |
---|---|---|---|
#4 | votingapi_cache.GIF | 22.96 KB | Junro |
#4 | affiche_views.GIF | 4.38 KB | Junro |
Comments
Comment #1
mercmobily CreditAttribution: mercmobily commentedHi,
It smells like a bug in VotingAPI.
Extra Voting Forms doesn't touch the way the average and the sum are calculated.
However... please add more information. In this case, please show the result of the relevant SELECT SQL statements after each vote, showing how the average is being calculated wrongly in the _cache table.
I will have a look... but I will most definitely ask you to move this onto VotingAPI.
Bye,
Merc.
Comment #2
Junro CreditAttribution: Junro commentedAs soon as I find how to have this information, i'll show you. I'm a newbie in code, so... I'm going to make some research... ^^
Comment #3
mercmobily CreditAttribution: mercmobily commentedHi,
I thought you'd wait before moving this issue to VotingAPI... However, while I am here: Eaton, I am 98% sure this has nothing to do with EVFf since I don't touch _any_ of the calculation hooks in EVF.
Bye!
Merc.
Comment #4
Junro CreditAttribution: Junro commentedHi Merc,well I think this is not VotingApi either, it's Views who doesn't display the VotingApi average result good.
However, I put you what I found in these two files, one is the votinapi_cache et the other the display of my view with everything.
So, do you think I have to move this onto Views?
Comment #5
mercmobily CreditAttribution: mercmobily commentedHi,
I honestly don't know. I would honestly wait and see what Eaton says :-)
(The maintainer of VotingAPI!)
Bye,
Merc.
Comment #6
Junro CreditAttribution: Junro commentedHi, Problem not fixe with the new version of Views (6.x-2.0-rc2) and Votingapi (6.x-2.0-beta7).
Waiting Eaton takes a look ^^
Comment #7
eaton CreditAttribution: eaton commentedThis looks really funky. I have *NO* idea how it would be adding double periods and such in there; I'll take a look at the vote formatting functions to see what might be happening. Is there any way you can post an export of the view in question, too?
Comment #8
Junro CreditAttribution: Junro commentedHello^^
Sure, I put it in attach file, don't esitate if you want something else.
Comment #9
Junro CreditAttribution: Junro commentedHello Eaton, did you find to fixe the bug?
Comment #10
Junro CreditAttribution: Junro commentedHello, I find something I didn't see before.
the display 12.0.6667 = 11.6667
the display 12.0.2223 = 12.2223 NOT 11.2223 LIKE I PUT IN THE PREVIOUS POST
If decimal >500 Integer = +1 (the display of the Integer is +1 of the good integer)
If decimal <500 Integer is good
I add this code below in the views-view-table.tpl but sure It's just hidding the bug, not resolve it.
I hope this bug will be resolve, so I will put off the .tpl code.
I call this bug: the bug "IP" due to the funny display of values (14.0.6667)
Thanks to Dickson for adding this code ^^
Comment #11
Junro CreditAttribution: Junro commentedPS: I think this bug has nothing to do with VotingApi but with View.
View doesn't seem to understand the votingapi result.
I'm not using Fivestar, Maybe is the reason. I'm using Extra Voting Form with rating from 0 to 20.
Comment #12
Junro CreditAttribution: Junro commentedHi Merlin, I'm sorry putting this bug in VotingApi before, I'm sure it's a bug with Views... and I'm sure You know because you had took off one of the code error.
The Bug "IP" (I call it IP) has change with the new version 2.1, and It's always wrong. You has took off just the "0.", I explain you:
with old version
11.6667 = 12.0.6667
12.2223 = 12.0.2223
with new version
11.6667 = 12.6667
12.2223 = 12.2223
I think you will understand just with this exemple lol.
So I rectified again my code to have the code result.
I hope this post will help you to change your code. If you need something to better understant the bug "IP", don't hesitate, ask me ^^ :)
Comment #13
Junro CreditAttribution: Junro commentedjust changing the title of the post ^^
Comment #14
kwemart CreditAttribution: kwemart commentednew code for debuging views's displaying of result;
Comment #15
merlinofchaos CreditAttribution: merlinofchaos commentedFixed in CVS.
Comment #16
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.