yacenty
Sep 16 2007, 07:32 AM
Hi all,
Could somebody tell me how does Best rated work?
For me it's crazy - in best rated on second place I have picture rated 5 but with only one rate, but on the third or even fifth site I have picture with average 5 and more than 30 rates.
Which one should be on the top?
Brandon You've told me that issue will be somehow solved in 2.2 but I'm not satisfied with this approach. Are there any chance to solve it in better way? a lo of my users compains about this feature
Thanks in advance,
BR
YacentY
bfarber
Sep 17 2007, 01:29 PM
It's sorted by
CODE
(i.ratings_total/i.ratings_count)
I wonder if I did
CODE
(i.ratings_total*i.ratings_count) DESC
if it would give you results like you are expecting. If you want to submit a ticket we can test this out if you like. It's a pretty minor change, and I can incorporate it later if it works out nicely.
Axel Wers
Sep 17 2007, 02:09 PM
I know this is NOT support forum or bug tracker but I can confirm this.
Order of Top Rated Images is weird (at my forum / gallery)
1. Image with rating 5 - total rates 1
2. Image with rating 5 - total rates 2
3. Image with rating 5 - total rates 1
4. Image with rating 5 - total rates 4 
5. Image with rating 5 - total rates 1
6. Image with rating 5 - total rates 1
7. Image with rating 5 - total rates 2
8. Image with rating 5 - total rates 2
9. Image with rating 5 - total rates 2
10. Image with rating 5 - total rates 3
yacenty
Sep 17 2007, 03:20 PM
It's exactly like on my site - no algorithm I see in it:)
Μichael
Sep 17 2007, 03:59 PM
What about sorting by this:
CODE
(i.ratings_total/i.ratings_count), i.ratings_count
That would sort by average rating first, then any ties there would be sorted by total rates.
yacenty
Sep 17 2007, 08:00 PM
I hope would be better
bfarber
Sep 17 2007, 08:13 PM
QUOTE(Μichael @ Sep 17 2007, 11:59 AM)

What about sorting by this:
CODE
(i.ratings_total/i.ratings_count), i.ratings_count
That would sort by average rating first, then any ties there would be sorted by total rates.
We'll go with that. If anyone would like to test it (i.e. yacenty) the change is on line 166 in sources/components_public/gallery/stats.php
Axel Wers
Sep 17 2007, 09:36 PM
QUOTE
the change is on line 166 in sources/components_public/gallery/stats.php
There is no gallery directory in components_public. The newest Gallery is required, right? I am still running 2.1.2 and my test Gallery 2.2.0 contains only 2 unratted images
bfarber
Sep 17 2007, 09:45 PM
Yes, newest Gallery is required.
You'll find nearly the same code, however, under modules/gallery/stats.php
Axel Wers
Sep 18 2007, 06:44 PM
OK thanks. I am going to test it at my 2.1.2 Gallery now
yacenty
Sep 19 2007, 07:44 PM
my lines 162-170 are:
$this->img_list->get_listing_data( array(
'st' => $st,
'show' => $this->num,
'approve' => 1,
'sort_key' => '(i.ratings_total/i.ratings_count), i.ratings_count',
'extra_where_clause' => '(i.ratings_total/i.ratings_count) > 0',
'order_key' => 'DESC',
'allow_cats' => $allow_cats,
'allow_albums' => $allow_albums,
) );
and the result is worse to the version without modification - why?
could You check it?
http://www.agrofoto.pl/forum/index.php?aut...&op=ratingsthanks in advance
BR
YacentY
bfarber
Sep 19 2007, 08:06 PM
Sorry, I should have replied with the actual code I added, you actually have to use
CODE
'sort_key' => '(i.ratings_total/i.ratings_count) DESC, i.ratings_count',
(Note DESC added into that line, the other DESC will get added after the ratings_count)
yacenty
Sep 19 2007, 08:37 PM
seems nicer:)
also one question more - what is the SQL querry behind? I would to get similiar top rated pictures on my main page and there I'm using direct SQL querry and now I have different 3 pictures so it's little bit inconsistent.
thanks for this small update:)
one question more: why now the picture in picture view has overall rate for example 36 but in best rated is located on third page and has overall rate 8? - is it possible to get these values equal? it can confuse users
bfarber
Sep 19 2007, 08:57 PM
The SQL query being generated here would depend upon the logged in user. You'd be best off just using the same API to get the top rated pictures on your home page.
You can see the full SQL query by enabling the SQL debug level in the ACP to level 3 under General Configuration (IPB settings), then it will be printed at the bottom of the page. Once you copy it down, set the debug level back to 0 or 1 as you don't want your SQL queries printing at the bottom of the screen for too long.
yacenty
Sep 20 2007, 05:51 AM
where can I find some info how to use this API?
thanks in advance,
BR
YacentY
bfarber
Sep 20 2007, 01:14 PM
There's no exactly a published API. I just meant reusing the same code the stats does (it uses an imagelisting library so that full permissions get honored and such).
I'd recommend inquiring on IPS Beyond for further assistance with this.
yacenty
Sep 20 2007, 08:40 PM
ok, I will try to do it during the weekend, because in week I'm totally tuff
AssassinCS
Sep 22 2007, 03:54 AM
This now works perfectly with
CODE
'sort_key' => '(i.ratings_total/i.ratings_count) DESC, i.ratings_count',
Hope to see that part of the next version by default

. Images are rated logically now.
yacenty
Nov 30 2007, 07:03 PM
Next issue with sorting of Best rated pictures.
With current soultion we have sth strange - for example I have picture with 30 rates and average is 4.97 and this picture is after picture that has only one rate (made by owner) - for me it's really anoying.
So I have a proposal - could we define number of rate that picture has to have to be shown in best rated?
And second issue - how to avoid rating pictures by their uploader?
Thanks in advance,
BR
YacentY
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.