Skip to content

Commit

Permalink
sort alphabetically in annex4 fixes #369
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgirard committed Mar 15, 2017
1 parent 42a95b5 commit 304af33
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions server/export/annex4.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Handlebars = require('handlebars'),
async = require('async'),
helpers = require('./helpers.js'),
COUNTRIES = require('../../specs/enum.countries.json'),
keyBy = require('lodash/keyBy');
{keyBy, sortBy} = require('lodash');

const {
getSimpleEnumValues,
Expand Down Expand Up @@ -772,7 +772,7 @@ const TABS = [
};
});

const invited = data.activities
let invited = data.activities
.filter(activity => activity.activityType === 'mob_sortante')
.map(activity => {
const person = activity.people
Expand All @@ -797,6 +797,8 @@ const TABS = [

return info;
});
invited = sortBy(invited, info => info.name);


return TEMPLATES.indices({
id,
Expand Down Expand Up @@ -824,6 +826,11 @@ module.exports = function annex4(models, centerId, callback) {
$match: {
'academicMemberships.organization': ObjectId(centerId)
}
},
{
$sort:{
'name': 1
}
}
], next);
},
Expand All @@ -832,6 +839,7 @@ module.exports = function annex4(models, centerId, callback) {
.find({
'organizations.organization': ObjectId(centerId)
})
.sort({'name':1,'acronym':1})
.populate('people.people')
.populate('organizations.organization')
.populate('grants.organization')
Expand Down

0 comments on commit 304af33

Please sign in to comment.