Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
Merge pull request #409 from andylolz/408-country-dropdown-order
Browse files Browse the repository at this point in the history
[#408] Fix country dropdown ordering
  • Loading branch information
andylolz committed Aug 22, 2014
2 parents 88f9568 + 44ca03e commit 84491c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 0 additions & 5 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,6 @@ Backend.prototype.getAllEntrysWithInfo = function(db, callback) {
});
entries.byplace = util.byPlace(db.places, results);

// take the opportunity to sort places by score
db.places = _.sortBy(db.places, function(place) {
return entries.byplace[place.id].score * -1;
});

var summary = util.getSummaryData(results);
summary.places = db.places.length;
entries.summary = summary;
Expand Down
7 changes: 6 additions & 1 deletion routes/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ var fs = require('fs')
;

exports.overview = function(req, res) {
// sort places by score
var sortedPlaces = _.sortBy(model.data.places, function(place) {
return model.data.entries.byplace[place.id].score * -1;
});

var extraWidth = (model.data.datasets.length > 12);
// note: model.data.places and model.data.entries.places are different
// the latter only has places for which we have some actual results
res.render('overview.html', {
summary: model.data.entries.summary,
extraWidth: extraWidth,
places: util.translateRows(model.data.places, req.locale),
places: util.translateRows(sortedPlaces, req.locale),
byplace: model.data.entries.byplace,
datasets: util.translateRows(model.data.datasets, req.locale),
scoredQuestions: util.translateRows(model.data.scoredQuestions, req.locale),
Expand Down

0 comments on commit 84491c8

Please sign in to comment.