Incorrect sort order for lottery/by-name #55

Merged
KevinMidboe merged 2 commits from bug/54 into master 2020-10-19 08:05:31 +00:00

View File

@@ -69,7 +69,7 @@ const all = (req, res) => {
const latest = (req, res) => { const latest = (req, res) => {
return groupHighscoreByDate() return groupHighscoreByDate()
.then(lotteries => lotteries.shift()) .then(lotteries => lotteries.shift()) // first element in list
.then(latestLottery => resolveWineReferences(latestLottery, "winners")) .then(latestLottery => resolveWineReferences(latestLottery, "winners"))
.then(lottery => res.send({ .then(lottery => res.send({
message: "Latest lottery!", message: "Latest lottery!",
@@ -120,7 +120,7 @@ const byName = (req, res) => {
.then(highscore => res.send({ .then(highscore => res.send({
message: `Lottery winnings for name: ${ name }.`, message: `Lottery winnings for name: ${ name }.`,
name: highscore.name, name: highscore.name,
highscore: highscore.wins highscore: sortNewestFirst(highscore.wins)
})) }))
} }