Reverse highscore for newest first.

This commit is contained in:
2020-10-09 00:52:04 +02:00
committed by KevinMidboe
parent 9b2de75910
commit 0e8bf9546a

View File

@@ -82,11 +82,13 @@ const byEpochDate = (req, res) => {
.then(highscore => getHighscoreByDates(highscore))
.then(async (lotteries) => {
const lottery = lotteries[date];
let highscoreWithResolvedWines = await resolveWineReferences(lottery)
highscoreWithResolvedWines = highscoreWithResolvedWines.reverse()
if (lottery != null) {
return res.send({
message: `Lottery for date: ${dateString}`,
lottery: await resolveWineReferences(lottery)
lottery: highscoreWithResolvedWines
})
} else {
return res.status(404).send({
@@ -104,7 +106,8 @@ const byName = (req, res) => {
.then(async (highscore) => {
highscore = highscore[0]
if (highscore) {
const highscoreWithResolvedWines = await resolveWineReferences(highscore.wins)
let highscoreWithResolvedWines = await resolveWineReferences(highscore.wins)
highscoreWithResolvedWines = highscoreWithResolvedWines.reverse()
return res.send({
message: `Lottery winnings by name: ${name}`,