From 7f72112bc5fa39cc1a55e5822135d9cc89fe234c Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Sun, 6 Oct 2019 17:31:43 +0200 Subject: [PATCH] fix: add new matches to MatchList in a correct order --- server/app/Helpers/MatchHelper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/app/Helpers/MatchHelper.js b/server/app/Helpers/MatchHelper.js index 53f994a..ad8d9fc 100644 --- a/server/app/Helpers/MatchHelper.js +++ b/server/app/Helpers/MatchHelper.js @@ -41,10 +41,10 @@ class MatchHelper { return summonerDB.matchList.some(m => m.gameId === newMatchList[newMatchList.length - 1].gameId) }) // Update Summoner's MatchList - for (const match of matchList) { + for (const match of matchList.reverse()) { if (!summonerDB.matchList.some(m => m.gameId === match.gameId)) { Logger.transport('file').info(`Match ${match.gameId} has been added to ${account.name}'s MatchList.`) - summonerDB.matchList.push(match) + summonerDB.matchList.unshift(match) } } await summonerDB.save()