Commits

Mathias Panzenböck committed 41146b9

ensure consistent sorting

  • Participants
  • Parent commits 1cb871a

Comments (0)

Files changed (1)

File javascripts/magnatune.js

 			return a.albumname < b.albumname ? -1 : a.albumname > b.albumname ? 1 : 0;
 		},
 		ArtistDateSorter: function (a,b) {
-			return b.latestdate - a.latestdate;
+			var cmp = b.latestdate - a.latestdate;
+			if (cmp === 0) {
+				return a.artist < b.artist ? -1 : a.artist > b.artist ? 1 : 0;
+			}
+			else {
+				return cmp;
+			}
 		},
 		AlbumDateSorter: function (a,b) {
-			return b.launchdate - a.launchdate;
+			var cmp = b.launchdate - a.launchdate;
+			if (cmp === 0) {
+				return a.albumname < b.albumname ? -1 : a.albumname > b.albumname ? 1 : 0;
+			}
+			else {
+				return cmp;
+			}
 		},
 		request: function (opts) {
 			var response = $.ajax({