diff --git a/static/mobile/js/item.js b/static/mobile/js/item.js index 7f81fa23..42c4d2cd 100644 --- a/static/mobile/js/item.js +++ b/static/mobile/js/item.js @@ -129,7 +129,10 @@ async function loadData(id, args) { ${icon.down} ${layerData.title} `) - data.layers[layer] = sortBy(data.layers[layer], ["+in", "+created"]) + data.layers[layer] = sortBy(data.layers[layer], [ + {key: "in", operator: "+"}, + {key: "created", operator: "+"} + ]) data.layers[layer].forEach(annotation => { if (pandora.url) { annotation.value = annotation.value.replace( diff --git a/static/mobile/js/utils.js b/static/mobile/js/utils.js index a22dc75a..e3597fd5 100644 --- a/static/mobile/js/utils.js +++ b/static/mobile/js/utils.js @@ -199,10 +199,10 @@ function sortBy(array, by, map) { while (ret == 0 && index < by.length) { key = by[index].key; aValue = getSortValue( - map[key] ? map[key](a[key], a) : a[key] + map && map[key] ? map[key](a[key], a) : a[key] ); bValue = getSortValue( - map[key] ? map[key](b[key], b) : b[key] + map && map[key] ? map[key](b[key], b) : b[key] ); if ((aValue === null) != (bValue === null)) { ret = aValue === null ? 1 : -1;