Sort attendees and suggestions from most to least popular

This commit is contained in:
Aaron Lindsay 2017-09-15 13:34:54 -04:00
parent 43919b3eca
commit 829bde700b
2 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ module.exports = function(state = [], action) {
for (var i = 0; i < action.attendees.length; i++) { for (var i = 0; i < action.attendees.length; i++) {
attendees.push(action.attendees[i]); attendees.push(action.attendees[i]);
} }
attendees.sort(function(a, b){return a.Popularity - b.Popularity}); attendees.sort(function(a, b){return b.Popularity - a.Popularity});
return attendees; return attendees;
case UserConstants.USER_LOGGEDOUT: case UserConstants.USER_LOGGEDOUT:
return []; return [];

View File

@ -10,7 +10,7 @@ module.exports = function(state = [], action) {
for (var i = 0; i < action.suggestions.length; i++) { for (var i = 0; i < action.suggestions.length; i++) {
suggestions.push(action.suggestions[i]); suggestions.push(action.suggestions[i]);
} }
suggestions.sort(function(a, b){return a.Popularity - b.Popularity}); suggestions.sort(function(a, b){return b.Popularity - a.Popularity});
return suggestions; return suggestions;
case UserConstants.USER_LOGGEDOUT: case UserConstants.USER_LOGGEDOUT:
return []; return [];