solved Top songs not working

maxcinsay
@maxcinsay
11 years ago
60 posts
Hello,
Im developing a custom skin based on jrElastic.

Im using this to list the top songs and it doesn't work:
{jrCore_list module="jrAudio" chart_field="audio_file_stream_count" chart_days="365" order_by="audio_file_stream_count desc" quota_id="4" template="side_charts_row_infinite.tpl" pagebreak="50" page=$_post.p assign="TOP_TEN_CHARTS"}

So I have only 16 test songs for this theme and the result shows how many times each song has been played, this is what I get:
Song 1 - 9 plays,
Song 2 - 7,
Song 3 - 6,
Song 4 - 5,
Song 5 - 5,
Song 6 - 5,
Song 7 - 3,
Song 8 - 2,
Song 9 - 2,
Song 10 - 11, (Here is where I can visualize the problem, the songs below this point have more 'plays' than the ones on the top)
Song 11 -11,
Song 12 - 11,
Song 13 - 11,
Song 14 - 10,
Song 15 - 10,
Song 16 - 10

It happens also when I change the days for the chart_days.

Could you help me figure this one out? Thank you
updated by @maxcinsay: 02/03/14 04:58:50PM
brian
@brian
11 years ago
10,148 posts
Anytime you sort by a number, you need to use the "numerical" version of the order - i.e.

order_by="audio_file_stream_count numerical_desc"

Otherwise the default sort is lexicographically.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
maxcinsay
@maxcinsay
11 years ago
60 posts
Thanks @brian! it worked once I added the numerical_desc.

This is the final code:
{jrCore_list module="jrAudio" chart_field="audio_file_stream_count" chart_days="365" order_by="audio_file_stream_count numerical_desc" quota_id="4" template="side_charts_row_infinite.tpl" pagebreak="50" page=$_post.p assign="TOP_TEN_CHARTS"}

For other users, I use quota 4 because thats the quota for the singers on my website, make sure you have the right one for your project
CAPER
CAPER
@caper
11 years ago
125 posts
make sure to mark this topic as [Solved} so other members may find this answer easily thanks
brian
@brian
11 years ago
10,148 posts
CAPER:
make sure to mark this topic as [Solved} so other members may find this answer easily thanks

This is a good idea - I'll try to take care of this on a lot of posts too.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
CAPER
CAPER
@caper
11 years ago
125 posts
Anytime Brian

Tags