From 13c422615d3d806613d92bd98abe8cad092eff04 Mon Sep 17 00:00:00 2001 From: Bruno Alves de Faria Date: Wed, 16 Nov 2016 12:09:00 -0200 Subject: [PATCH] LT-292: Fixing timepoints sorting --- .../ohif-measurements/both/configuration/timepoints.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Packages/ohif-measurements/both/configuration/timepoints.js b/Packages/ohif-measurements/both/configuration/timepoints.js index 2e468e8a8..631ee4989 100644 --- a/Packages/ohif-measurements/both/configuration/timepoints.js +++ b/Packages/ohif-measurements/both/configuration/timepoints.js @@ -110,7 +110,11 @@ class TimepointApi { // Return all timepoints all() { - return this.timepoints.find().fetch(); + return this.timepoints.find({}, { + sort: { + latestDate: -1 + }, + }).fetch(); } // Return only the current timepoint @@ -251,7 +255,7 @@ class TimepointApi { title(timepoint) { const timepointName = this.name(timepoint); - const all = _.clone(this.all()).reverse(); + const all = _.clone(this.all()); let index = -1; let currentIndex = null; for (let i = 0; i < all.length; i++) {