rating 2.1.2 ranking bugs
Posted: 23 April 2008 03:59 AM   [ Ignore ]
Newbie
Rank
Total Posts:  10
Joined  2005-07-19

I have a load of restaurant reviews. Each review provides rating of 4 different criteria - food, service, ambience and value. I wanted to make a page showing a table showing the top 5 restaurants for each of these criteria. Looking at the modules documentation the following should work:

{exp:rating:rankings form_name="restaurants" orderby="avg_food_rating" sort="desc" limit="5"}

But it would appear that you cannot do orderby="some_custom_rating_field", as stated in the docs.

Thanks to another post on this forum I eventually solved this by hacking mod.rating.php.

I changed the following (found at about line 844) from:

$q  = array(
   
'overall_count' => 'count',
   
'overall_sum' => 'sum',
   
'overall_avg' => 'avg'
   
);

to:

$q  = array(
   
'overall_count' => 'count',
   
'overall_sum' => 'sum',
   
'overall_avg' => 'avg',
   
'avg_food_rating' => 'avg_4',
   
'avg_service_rating' => 'avg_5',
   
'avg_ambience_rating' => 'avg_6',
   
'avg_value_rating' => 'avg_7'
   
);

So that problem was fixed. Then I noticed another oddity. I want the top 5 restaurants in the table so I had used limit="5" but I only get 4 results. Whatever number I put in limit="x" I always get one less than I should.

Best regards
Martin

Profile
 
 
Posted: 23 April 2008 07:10 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2747
Joined  2006-10-18

Martin,

We’re in the process of mowing down a large list of bug fixes, and this will be included smile
It should be available very soon! smile

I will keep you updated.

 Signature 
Profile
 
 
Posted: 23 April 2008 10:11 AM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
Rank
Total Posts:  13
Joined  2005-08-19

Martin,

Just to clarify, do you always get 1 less item than you should, or does the discrepancy only occur after you put your hack in place?

 Signature 
Profile
 
 
Posted: 23 April 2008 10:15 AM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  10
Joined  2005-07-19

I was getting the “1 less” problem before the hack.

Profile
 
 
Posted: 23 April 2008 12:13 PM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
Rank
Total Posts:  13
Joined  2005-08-19

Do you have one or more entries that (a) have a status other than open (i.e. closed or pending) and/or (b) are expired? If so, I see exactly what’s going on. I’m not quite sure yet how I want to fix it, but I have a couple ideas.

 Signature 
Profile
 
 
Posted: 23 April 2008 12:21 PM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  10
Joined  2005-07-19

As far as I can see, the status of all of the weblog entries are open and the status of all the reviews are open.

Profile
 
 
Posted: 01 May 2008 08:44 AM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  10
Joined  2005-07-19

This bug is driving me crazy as it isn’t even consistent:

{exp:rating:rankings form_name="restaurants" orderby="avg_food_rating" sort="desc" limit="6"}

shows 5 results and

{exp:rating:rankings form_name="restaurants" orderby="avg_service_rating" sort="desc" limit="6"}

shows 6 results

Before I resort to the horrible hack of using limit="10" and using count on the frontend to show the right amount, have you any ideas where I should be looking in the code for this bug.

Thanks
Martin

Profile
 
 
Posted: 02 May 2008 01:32 AM   [ Ignore ]   [ # 7 ]
Newbie
Rank
Total Posts:  10
Joined  2005-07-19

As the post above suggests, there was an issue with the underlying data. When I looked at the output of some of the sql queries I noticed that the query below returned an entry id that did not exist.

SELECT DISTINCT s.entry_id FROM exp_rating_stats AS s LEFT JOIN exp_category_posts AS cp ON cp.entry_id s.entry_id LEFT JOIN exp_categories AS c ON c.cat_id cp.cat_id WHERE s.entry_id != '' ORDER BY s.avg DESC LIMIT 6

Once I deleted the offending entry from the exp_rating_stats table everything works as expected. The concern is obviously how the ranking stats for that entry remained in the db after that entry was deleted.

Best regards
Martin

Profile
 
 
Posted: 02 May 2008 04:52 AM   [ Ignore ]   [ # 8 ]
Administrator
Avatar
Rank
Total Posts:  13
Joined  2005-08-19

Thanks for the update, Martin. I’ll see what I can uncover.

 Signature 
Profile
 
 
Posted: 20 June 2008 08:17 AM   [ Ignore ]   [ # 9 ]
Newbie
Rank
Total Posts:  20
Joined  2008-03-31

Is there any update to this?

I am having the same/similar problem. If I have a limit of 5 then only one entry shows that has 2 ratings, but if I change the limit to 10 then 3 entries show. I have a site that needs to launch the first week of July and would love to have a solution since most of their content is going to be rated.

Thanks,
Mike

 Signature 

Mike Dupre
TDC Design | Richmond VA

Profile
 
 
Posted: 20 June 2008 08:20 AM   [ Ignore ]   [ # 10 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2747
Joined  2006-10-18

Mike,

We’re still working at the big release of Rating 2.2.0… it should not be too much longer smile

I apologize for the inconvenience…

 Signature 
Profile
 
 
Posted: 23 July 2008 08:53 PM   [ Ignore ]   [ # 11 ]
Newbie
Rank
Total Posts:  2
Joined  2008-07-20

I’m also seeing this behavior. In addition, the “form_name” parameter doesn’t seem to be respected. For example:

{exp:rating:rankings form_name="business" orderby="my_overall_rating" sort="desc"}
 
<li>{exp:rating:stats entry_id="{entry_id}" theme="default" precision="1" thousands="," fractions="."}{avg_my_overall_rating}{/exp:rating:stats} {title}</li>
{/exp:rating:rankings}

This gives me:

<li>2.0 Albany Law School</li>
 <
li>4.0 University of Alabama School of Medicine</li>
 <
li>4.0 Adelphi University</li>
 <
li>3.0 American University of Cairo</li>
 <
li>2.0 Alfred University</li>
 <
li>1.5 Cornell Law School</li>
 <
li>1.0 Adelphi University</li>
 <
li>3.0 University of South Alabama College of Medicine</li>

Note that not only are the entries in the wrong order, but they’re not all business schools, either.

Any thoughts?

Thanks,
Ben

Profile
 
 
Posted: 25 July 2008 07:17 AM   [ Ignore ]   [ # 12 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2747
Joined  2006-10-18

Ben,

Thanks for letting us know… it seems in fact that it does not respect the form_name="” parameter smile

This will be fixed for the upcoming release smile

 Signature 
Profile
 
 
Posted: 29 August 2008 10:55 AM   [ Ignore ]   [ # 13 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2747
Joined  2006-10-18

Martin & Ben,

These issues have been corrected in the release of Rating 2.2.0, now available for download. smile

 Signature 
Profile
 
 
   
 
 
‹‹ rating_rev_stats bug      Rating Average ››