summaryrefslogtreecommitdiff
path: root/www/js/shows.js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-01 23:57:25 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-01 23:59:02 (GMT)
commit52233b8ca0dd227cfdc1dbed9bb7f4d04c5d152f (patch)
tree26cbb33b6d841c8fdf8e18256296e6c8c91fa2f9 /www/js/shows.js
parentb79e536f5333102aa746656a6878890e4b3f3a96 (diff)
fixed sorting for show and musicpool selector
Diffstat (limited to 'www/js/shows.js')
-rw-r--r--www/js/shows.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/www/js/shows.js b/www/js/shows.js
index 81d9e5a..1ec986d 100644
--- a/www/js/shows.js
+++ b/www/js/shows.js
@@ -99,10 +99,25 @@ Rdxport.ShowListView.prototype.updateSelector = function() {
$('li', $showSelector).remove();
$(this.model.groups).sort(function(a, b) {
- if(a.title.toLowerCase() == b.title.toLowerCase()) {
- return b.rhythm - a.rhythm;
+ var atitle = a.title.toLowerCase();
+ var btitle = b.title.toLowerCase();
+ if(atitle == btitle) {
+ if(b.rhythm == a.rhythm) {
+ if(a.dayofweek == b.dayofweek) {
+ if(a.starttime == b.starttime) {
+ return a.showid - b.showid;
+ }
+ if(a.starttime > b.starttime) return 1;
+ return -1;
+ }
+ var adow = a.dayofweek == 0 ? 7 : a.dayofweek;
+ var bdow = b.dayofweek == 0 ? 7 : b.dayofweek;
+ return adow - bdow;
+ }
+ return parseInt(b.rhythm) - parseInt(a.rhythm);
}
- return a.title.toLowerCase() >= b.title.toLowerCase()
+ if(atitle > btitle) return 1;
+ return -1;
}).each(function(index, show) {
var name = show.id + ' | <strong>' + show.title + '</strong> (' + show.rhythm + ', ' + weekday[show.dayofweek] + ', ' + show.starttime + ', ' + show.length + ' Min.)';
var link = $('<a>').attr('href', '#').html(name).click(function() {