From 56edf7e4d6bc6fd1549dc3807bd85760276698c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Midb=C3=B8e?= Date: Mon, 19 Oct 2020 10:00:47 +0200 Subject: [PATCH 1/2] by-name endpoint sorts wins newest first. --- api/lottery.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/lottery.js b/api/lottery.js index bdd9032..62ee497 100644 --- a/api/lottery.js +++ b/api/lottery.js @@ -120,7 +120,7 @@ const byName = (req, res) => { .then(highscore => res.send({ message: `Lottery winnings for name: ${ name }.`, name: highscore.name, - highscore: highscore.wins + highscore: sortNewestFirst(highscore.wins) })) } From 82512fa4bab31cbc739b104e798e0a61d7d9b907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Midb=C3=B8e?= Date: Mon, 19 Oct 2020 10:01:53 +0200 Subject: [PATCH 2/2] Comments for readability. --- api/lottery.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/lottery.js b/api/lottery.js index 62ee497..0f7d218 100644 --- a/api/lottery.js +++ b/api/lottery.js @@ -69,7 +69,7 @@ const all = (req, res) => { const latest = (req, res) => { return groupHighscoreByDate() - .then(lotteries => lotteries.shift()) + .then(lotteries => lotteries.shift()) // first element in list .then(latestLottery => resolveWineReferences(latestLottery, "winners")) .then(lottery => res.send({ message: "Latest lottery!",