From ecbc75df0698218df3481d110d3a9e172bf2c8a1 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 1 Dec 2014 23:19:05 +0100 Subject: [PATCH] Sort contributions search result --- inc/myco.js | 1 - inc/myco_objects.js | 16 ++++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/inc/myco.js b/inc/myco.js index 06174f9..07e672f 100644 --- a/inc/myco.js +++ b/inc/myco.js @@ -180,7 +180,6 @@ show_contributions=function(group,contributor_email,contributions) { tbody.html(''); if (!contributions) { contributions=group.contributionsByContributorEmail(contributor_email); - contributions.reverse(); } _current_displayed_contributions=contributions; _current_displayed_contributions_group=group; diff --git a/inc/myco_objects.js b/inc/myco_objects.js index 5bac102..1f464ee 100644 --- a/inc/myco_objects.js +++ b/inc/myco_objects.js @@ -230,18 +230,22 @@ function Group(uuid,name,data) { ret.push(this.contributions[uuid]); } } - ret.sort(function(a,b) { + return this.sortContributionsByDate(ret); + } + + this.sortContributionsByDate=function(contributions) { + contributions.sort(function(a,b) { if (a.date==b.date) { return 0; } else if(a.date