Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2   Go Down

Author Topic: TopRated shows pictures with most votes not best average?  (Read 9430 times)

0 Members and 1 Guest are viewing this topic.

jp-photo.dk

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
    • JP-photo.dk
TopRated shows pictures with most votes not best average?
« on: September 15, 2004, 03:03:18 pm »

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
Logged

Nibbler

  • Guest
Re: TopRated shows pictures with most votes not best average?
« Reply #1 on: September 15, 2004, 03:08:10 pm »

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

jp-photo.dk

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
    • JP-photo.dk
Re: TopRated shows pictures with most votes not best average?
« Reply #2 on: September 15, 2004, 03:16:45 pm »

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
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: TopRated shows pictures with most votes not best average?
« Reply #3 on: September 15, 2004, 09:30:06 pm »

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

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
    • JP-photo.dk
Re: TopRated shows pictures with most votes not best average?
« Reply #4 on: September 16, 2004, 07:50:24 am »

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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: TopRated shows pictures with most votes not best average?
« Reply #5 on: September 16, 2004, 08:28:07 am »

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

Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: TopRated shows pictures with most votes not best average?
« Reply #6 on: September 16, 2004, 10:49:31 am »

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;

Code: [Select]
$ALBUM_SET ORDER BY ROUND((pic_rating+1)/2000) DESC, votes DESC $limit";
Change this to;

Code: [Select]
$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.
Logged
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

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: TopRated shows pictures with most votes not best average?
« Reply #7 on: September 16, 2004, 11:15:31 am »

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

Code: [Select]
$ALBUM_SET ORDER BY ROUND((pic_rating+1)/1.298) DESC, votes DESC $limit";
Please report if this works for you.
Logged
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

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
Re: TopRated shows pictures with most votes not best average?
« Reply #8 on: September 16, 2004, 02:20:30 pm »

Casper can you explain how you got 1.298
Logged
SANIsoft PHP applications for E Biz

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: TopRated shows pictures with most votes not best average?
« Reply #9 on: September 16, 2004, 02:47:10 pm »

Not really  :-[.

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

Quote
ROUND(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.
Logged
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

  • Guest
Re: TopRated shows pictures with most votes not best average?
« Reply #10 on: September 16, 2004, 03:00:00 pm »

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 ?
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: TopRated shows pictures with most votes not best average?
« Reply #11 on: September 16, 2004, 03:12:18 pm »

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;

Code: [Select]
$ALBUM_SET ORDER BY pic_rating DESC, votes DESC $limit";
Logged
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

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: TopRated shows pictures with most votes not best average?
« Reply #12 on: September 16, 2004, 03:22:02 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.
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: TopRated shows pictures with most votes not best average?
« Reply #13 on: December 12, 2004, 02:14:38 pm »

Bump;

has anyone tested this yet (my post above), so I can add this to the next version.
Logged
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

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: TopRated shows pictures with most votes not best average?
« Reply #14 on: December 15, 2004, 11:05:21 am »

I have committed the above fix to version 1.4.
Logged
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

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 52
Re: TopRated shows pictures with most votes not best average?
« Reply #15 on: December 15, 2004, 11:28:44 pm »

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

peakoverload

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 51
Re: TopRated shows pictures with most votes not best average?
« Reply #16 on: January 17, 2005, 12:25:11 pm »

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
Logged

radial

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: TopRated shows pictures with most votes not best average?
« Reply #17 on: January 18, 2005, 02:40:45 am »

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
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: TopRated shows pictures with most votes not best average?
« Reply #18 on: January 18, 2005, 11:19:03 am »

@ 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.
Logged
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

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 51
Re: TopRated shows pictures with most votes not best average?
« Reply #19 on: January 18, 2005, 12:07:51 pm »

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.
Logged
Pages: [1] 2   Go Up
 

Page created in 0.026 seconds with 20 queries.