Getting the highest rated documents... using Ditto
I tried call ditto using this...
[!Ditto? &parents=`3` &hideFolders=`1` &depth=`2` &sortBy=`star_rating` &display=`5`!]
But that gives me the top 5 with the "most" points, not the top rated. (5:1, is rated higher than 6:2 and yet 6.2 will sort higher)
I tried creating a TV with the @EVAL’d score, but ditto doesn’t like that. So I modified the snippet.
I shifted all $splitVals[] up one ($splitVals[0] = $splitVals[1] , $splitVals[1] = $splitVals[2])
126 $newRating = round(($newCount / $newVoteNumber)*100);
127
128 @ setTemplateVar("$newRating:$newCount:$newVoteNumber", $pid, $tvName);
Now when I sort by "star_rating" it uses the first number and ignores anything after the : delimiter.
Any problems with this, Garry?