Skip to content

Commit

Permalink
Fixed sorting cases, first known then unknown desc
Browse files Browse the repository at this point in the history
  • Loading branch information
mwithi committed Sep 24, 2020
1 parent 40bed48 commit 3dbbdd4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions templates/disease_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
}

/*
* (function) sum up 'count' with the same disease 'id'
* and return sorted totals (reverse)
*/
* (function) sum up 'count' with the same disease 'id'
* and return sorted totals (reverse)
*/
function summarize_and_sort_list() {
unique_list = _.uniqBy(disease_list, 'id');
unique_list.forEach(function(item, index) {
Expand All @@ -78,6 +78,10 @@
unique_list[objIndex].count = sum;
unique_list[objIndex].unknown = sum_unknown;
});
disease_list = _.sortBy(unique_list, 'count').reverse();
// disease_list = _.sortBy(unique_list, 'count').reverse();
disease_list = _.orderBy(unique_list, [
function (item) { return item.count; },
function (item) { return item.unknown; }
], ["desc", "desc"]);
}
</script>

0 comments on commit 3dbbdd4

Please sign in to comment.