Feat/personal highscore #44

Merged
KevinMidboe merged 19 commits from feat/personal-highscore into master 2020-10-11 16:19:52 +00:00
Showing only changes of commit 0e8bf9546a - Show all commits

View File

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