2016-12-26 08:29:18 -05:00
|
|
|
var assign = require('object-assign');
|
|
|
|
|
|
|
|
var AttendeeConstants = require('../constants/AttendeeConstants');
|
|
|
|
var UserConstants = require('../constants/UserConstants');
|
|
|
|
|
2016-12-28 09:25:20 -05:00
|
|
|
module.exports = function(state = [], action) {
|
2016-12-26 08:29:18 -05:00
|
|
|
switch (action.type) {
|
|
|
|
case AttendeeConstants.POPULAR_ATTENDEES_FETCHED:
|
2016-12-28 09:25:20 -05:00
|
|
|
var attendees = [];
|
2016-12-26 08:29:18 -05:00
|
|
|
for (var i = 0; i < action.attendees.length; i++) {
|
2016-12-28 09:25:20 -05:00
|
|
|
attendees.push(action.attendees[i]);
|
2016-12-26 08:29:18 -05:00
|
|
|
}
|
2016-12-28 09:25:20 -05:00
|
|
|
attendees.sort(function(a, b){return a.Popularity - b.Popularity});
|
2016-12-26 08:29:18 -05:00
|
|
|
return attendees;
|
|
|
|
case UserConstants.USER_LOGGEDOUT:
|
2016-12-28 09:25:20 -05:00
|
|
|
return [];
|
2016-12-26 08:29:18 -05:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|