From 7bc7f0a7dcf728ac06afa95b035205c6db5649ac Mon Sep 17 00:00:00 2001 From: Davor Spasovski Date: Wed, 16 Aug 2017 14:22:08 -0400 Subject: [PATCH] sort query version select options (re #198) --- client/app/pages/queries/compare-query-dialog.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/app/pages/queries/compare-query-dialog.js b/client/app/pages/queries/compare-query-dialog.js index bdb5c4d97e..fb4338971a 100644 --- a/client/app/pages/queries/compare-query-dialog.js +++ b/client/app/pages/queries/compare-query-dialog.js @@ -32,6 +32,17 @@ const CompareQueryDialog = { $http.get(`/api/queries/${this.currentQuery.id}/version`).then((response) => { this.versions = response.data; + + const compare = (a, b) => { + if (a.object_version < b.object_version) { + return -1; + } else if (a.object_version > b.object_version) { + return 1; + } + return 0; + }; + + this.versions.sort(compare); this.compareQueries(true); }); }],