summaryrefslogtreecommitdiff
path: root/www
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
parentb79e536f5333102aa746656a6878890e4b3f3a96 (diff)
fixed sorting for show and musicpool selector
Diffstat (limited to 'www')
-rw-r--r--www/js/musicpools.js10
-rw-r--r--www/js/shows.js21
2 files changed, 27 insertions, 4 deletions
diff --git a/www/js/musicpools.js b/www/js/musicpools.js
index 0ce1c9c..db295c7 100644
--- a/www/js/musicpools.js
+++ b/www/js/musicpools.js
@@ -99,7 +99,15 @@ Rdxport.MusicpoolsView.prototype.updateSelector = function() {
$('li', $musicpoolSelector).remove();
$(this.model.groups).sort(function(a, b) {
- return a.title.toLowerCase() >= b.title.toLowerCase()
+ var atitle = a.title.toLowerCase();
+ var btitle = b.title.toLowerCase();
+ if(atitle == btitle) {
+ if(a.clock > b.clock) return 1;
+ if(a.clock < b.clock) return -1;
+ return 0;
+ }
+ if(atitle > btitle) return 1;
+ return -1;
}).each(function(index, musicpool) {
var name = '<strong>' + musicpool.title + '</strong> (' + musicpool.clock + ')';
var link = $('<a>').attr('href', '#').html(name).click(function() {
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() {