Active
Project:
Dash Media Player
Version:
6.x-1.6
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Jul 2009 at 17:07 UTC
Updated:
9 Dec 2009 at 16:30 UTC
in voting_service.module, the method that returns the average user vote only returns the first vote for any piece of content.
line 145:
function voting_service_get_vote($content_type, $content_id, $tag = "vote") {
$criteria['content_type'] = $content_type;
$criteria['content_id'] = $content_id;
$criteria['tag'] = $tag;
$criteria['value_type'] = 'percent';
$votes = votingapi_select_votes($criteria);
if($votes) {
return $votes[0]; //This is not the average of the user votes, it is just the first vote made...
}
else
{
return array('type'=> $content_type, 'tag' => $tag, 'value' => 0);
}
}
Comments
Comment #1
travist commentedGreat observation! I am planning on coming out with a new version of the module this weekend and will try to include this fix.
Thank you so much for your efforts!
Travis.
Comment #2
MixologicI dont know how to make a patch, but I did figure out that if you change
To
It will return the average instead of the first vote, though there is still something wonky with the display.. sometimes the average will show up in the user vote field on the display. Check it..
Comment #3
travist commentedRyan,
If you use this method, would you still return $votes[0]?...
Thanks,
Travis.
Comment #4
MixologicYes, votingapi_select_results() queries the votingapi_cache table, which contains the precalculated count, and average of votes for a particular nodeid, ($criteria['function'] is either 'count' or 'average'). So when I looked into the db with phpMyadmin, theres only one row per node, per function.
A Second issue I noticed once I have this implemented though is happening on the player side. I think that after a user clicks on the vote, it calls vote.setVote, then calls vote.getVote to set the new average, and then assigns that to both the user's vote and the average vote. I think either there needs to be another call to vote.getUserVote or it shouldnt assign the vote.getVote to the users stars. Im unsure if this is a problem with the Skin or the player..
Comment #5
travist commentedHey Ryan,
I have spent quite a bit of time on this today and think I got it working properly. I have updated this module and the Dash Media Player at ( http://www.tmtdigital.com/project/dash_player ). Please let me know if this fixed the problem.
Thanks,
Travis.
Comment #6
MixologicIts definitely sending and setting the right values. I just updated to the latest versions of dashplayer and the latest module.
It still seems like when I vote its setting the new average to both sets of stars.. If I have a new node with no votes, and click five, they both get set to five, then, logged in as another user, I vote on two stars and the results show 3.5 stars for the average (correct) *and* for my vote (I assume thats incorrect)
Anyhow, yeah, I've sunk a buncho time into this as well, but It's all knowledge building for me.. I am now intimately familiar with services, voting api, flashvideo.
In any case be on the lookout for a license key purchase from my client, (m.g. in wilsonville).
Thanks for all your effort.. this is one seriously sweet solution!
Comment #7
anasynth commentedHi, sorry this is a little off topic, but since this issue is active and recent I thought I'd post here.
I've followed your very well laid out video tutorials to install dash player and its working great. I'm just using it on my site as a way to display key content (videos) on the main page. There's only going to be around 4 videos in the player and as such the voting system is not such an important aspect for me. I haven't installed voting api and I was wondering if there was a way for me to remove the voting section from the player, since in my case it is not needed.
Would this be possible?
Thanks
Comment #8
MixologicWhen you instantiate the player, you need merely include:
$params['votingenabled'] = 'false';
And the stars disappear...
Comment #9
anasynth commentedAh, great. Can I disable the views counter as well? I assume its a similar syntax...
Comment #10
platonik commentedYes, you can disable it the same way with this flashvar:
Comment #11
anasynth commentedThat's perfect, platonik, thanks to you and Ryan.