From a64f9426026e5a3e299e0f9167105b96c7a0ecc8 Mon Sep 17 00:00:00 2001 From: "Dylan A. Orshefsky" Date: Tue, 18 Dec 2018 15:12:52 -0500 Subject: [PATCH] fixes bug where releases showing oldest first --- app/routes/games/helpers.js | 5 ++++- app/routes/games/index.js | 4 ++-- package.json | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/routes/games/helpers.js b/app/routes/games/helpers.js index 98f4768..87c6423 100644 --- a/app/routes/games/helpers.js +++ b/app/routes/games/helpers.js @@ -51,7 +51,10 @@ function renderPage(req, res, template, populate=null) { var game = Game.getBySlug(req.params.slug, done); if (populate){ - game.populate(populate); + game.populate({ + path: populate, + options: { sort: { 'updated': -1 } } + }); }; }, function(game, done) diff --git a/app/routes/games/index.js b/app/routes/games/index.js index 356d43f..e30bfda 100644 --- a/app/routes/games/index.js +++ b/app/routes/games/index.js @@ -50,13 +50,13 @@ router.get('/:slug', function(req, res) router.get('/:slug/privileges', function(req, res) { // have to pass addt'l param to resolve Group objects - renderPage(req, res, 'games/privileges', ['groups.group']); + renderPage(req, res, 'games/privileges', 'groups.group'); }); router.get('/:slug/releases', function(req, res) { // have to pass addt'l param to resolve Release objects - renderPage(req, res, 'games/releases', ['releases']); + renderPage(req, res, 'games/releases', 'releases'); }); router.patch('/:slug/releases/:commit_id', async function(req, res) diff --git a/package.json b/package.json index 4acbed1..7d35e9e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.6.1", + "version": "1.6.2", "private": true, "devDependencies": { "glob": "^7.1.2",