Sort contributions search result

This commit is contained in:
Benjamin Renard 2014-12-01 23:19:05 +01:00 committed by root
parent 3fe0e8d2ef
commit ecbc75df06
2 changed files with 10 additions and 7 deletions

View file

@ -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;

View file

@ -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<b.date) {
return -1;
}
else {
return 1;
}
else {
return -1;
}
});
return ret;
return contributions;
}
this.deletedContributionsByContributorEmail=function(email) {
@ -345,7 +349,7 @@ function Group(uuid,name,data) {
ret.push(this.contributions[uuid]);
}
}
return ret;
return this.sortContributionsByDate(ret);
}
this.getContributionsByCategory=function (category) {