TopRated shows pictures with most votes not best average? TopRated shows pictures with most votes not best average?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

TopRated shows pictures with most votes not best average?

Started by jp-photo.dk, September 15, 2004, 03:03:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jp-photo.dk

Have I understood this correct? That TopRated shows the pictures with the most votes, and not the best average? I have an example here: http://www.jp-photo.dk/galleri/thumbnails.php?album=toprated&cat=0

Is is possible to get CPG to show the best average instead?

Regards,
Jan

Nibbler

They are sorted by rating first, then by  number of votes. Should be clearer if you look at the last page of your top rated section, the last pic has 30 votes, the second to last has 18.

jp-photo.dk

But the #1 picture has a rating of 4.7 with 38 votes and #2 a rating of 4.8 with 37 votes??

Regards,
Jan

Casper

OK, you are both correct, in that it is done by rating first, but is note done to the nearest fraction of a point.  If you look at page 2, you will see the 2 horses picture has had 137 votes, but several pics rated above it have only 3 votes.
This is something we can look at.

But if we do go to fractions, it means that a pic with just 1 vote at 5, will be shown above one with 100 votes, 99 of which were 5, but 1 was 4.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

jp-photo.dk

Yes - that could be solved by adjusting the number of votes needed before shown in the TopRated. This is already in the configuration. So a listing with fractions would be really great.

Regards,
Jan

Joachim Müller

jp-photo.dk is right, we should add this to the code (busy sites with huindreds of votes per pic will surely not set the number of votes needed to such low values as "1"). Casper, could you do this?

Joachim


Casper

OK,
I don't have a setup with multiple votes already applied, so this is not well tested.

@jp-photo.dk, please test this on your site, and report if it works without problem.  If it does, I will commit to cvs.

Open include/functions.inc.php, and find;

$ALBUM_SET ORDER BY ROUND((pic_rating+1)/2000) DESC, votes DESC $limit";

Change this to;

$ALBUM_SET ORDER BY ROUND((pic_rating+1)/2000.23) DESC, votes DESC $limit";

From my limited understanding of the mysql manual, and my limited testing, this seems to do it.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Casper

Change to above, which did not work fully.  The new code should be;

$ALBUM_SET ORDER BY ROUND((pic_rating+1)/1.298) DESC, votes DESC $limit";

Please report if this works for you.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Tarique Sani

SANIsoft PHP applications for E Biz

Casper

Not really  :-[.

I was reading the mySQL manual, with reference to the 'ROUND' function, and getting confused.  This is the info in the manual;

QuoteROUND(X,D)
Returns the argument X, rounded to the nearest integer. With two arguments, returns X rounded to D decimals. If D is negative, the integer part of the number is zeroed out. mysql> SELECT ROUND(-1.23);
       -> -1
mysql> SELECT ROUND(-1.58);
       -> -2
mysql> SELECT ROUND(1.58);
       -> 2
mysql> SELECT ROUND(1.298, 1);
       -> 1.3
mysql> SELECT ROUND(1.298, 0);
       -> 1
mysql> SELECT ROUND(23.298, -1);
       -> 20


I tried adding the decimal points to the existing '2000' (where that came from I don't know) and it worked to a degree, but not completely.  I then thought I'd try with the 1.298 as in the manual, and it seemed to work, albeit on my site with extremely linited scope to test this.

I don't know why it works, or if it works fully as we want, which is why I've asked for it to be tested on sites that have plenty of pics and votes.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Nibbler

Those numbers are examples for rounding, it says you round 1.298 to 0 decimal places you get 1.

Can we not simply order by pic_rating ?

Casper

Alright, I was tired this morning, and confused.  I saw that query, with numbers like 2000, and thought it would be more complicated than it really is. :-[

I have tried this on my site, and it seems to work, so please test.

Change the above code to;

$ALBUM_SET ORDER BY pic_rating DESC, votes DESC $limit";
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Tranz

Quote from: Casper on September 16, 2004, 02:47:10 PM
I tried adding the decimal points to the existing '2000' (where that came from I don't know)
2000 is the value per point. So, a vote of 5/5 is worth 10000, 1/5 is 2000. That was what I figured from looking at the vote values in the dB.

Casper

Bump;

has anyone tested this yet (my post above), so I can add this to the next version.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Casper

It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

panwac

It was tested in my test-gallery - in this moment it looks fine. ;)

peakoverload

I think/hope that this is the answer to the problem I am having here http://forum.coppermine-gallery.net/index.php?topic=13787.0

The thing is that I am now totally confused as to how Top Rated is NOW working with this hack as I wasnt that sure how it worked BEFORE the hack  :-[ and the difference it made was huge!

Before I applied this hack I found that:
The photos in 20th (photo ID 1652) and 21st (photo ID 1663) position were, I think, the wrong way around.

Photo 1652 has a score of 4.7/5 with 3 votes
Photo 1663 has a score of 5/5 with 3 votes

Looking in the database
Photo 1652 has a score of 9333
Photo 1663 has a score of 10000

So by my thinking they should have been the other way around.

Now that I have applied this hack these two photos are now the opposite way around just much further apart 1663 has moved from 21st place to 5th place whilst 1652 has moved from 20th place to 25th place.

I guess what I am getting at is that to my thinking a photo that has received 3 votes of 5 stars should be higher than a photo that gets 2 votes of 5 stars obviously but that a photo that 3 votes each of 4 stars should be higher than a photo that got 2 votes of 5 stars i.e. the scores are added. 3x5=15, 2x5=10, 3x4=12

That WAS how I thought the Coppermine voting system originally worked anyway but then that doesnt explain the order I was seeing. Sorry to be thick but is that how this hack then organises them? I'm sooooo confused  :D

radial

This is just an idea I had, i could be absolutely wrong, but wanted to throw my 2 cents in.

None of the ideas i've seen calculate date into the equation.

A picture that has been on the site for 5 days and has 10 views should be higher rated / more popular than a picture that has been on the site for 20 days and has 15 views.

Just an idea ;)

Phil Hart
www.radialmonster.com/photogallery

Casper

@ Peakoverload,

you are comparing 2 pics with only 3 votes each.  What about the others in the equation.  This is fairly low voting, but are they all now correctly placed, they should be.

And differences should become more apparent as they receive more votes.

At radial,

your idea would remove the individuals choice of which photos to vote on.  Just by going to the pic would give it a vote, even if once there the viewer decided they did not like it.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

peakoverload

Thanks for this hack Casper and for explaining this to me (sorry for being slow on the uptake). Can I just ask one last question.

With this hack is the voting system more open to abuse than it was before? By that I mean if someone wanted to increase the position of their photo could they deliberately give a low vote to someone elses photo to make their's jump higher?

This is the main thing with average scores that I dont really understand.