From 46d2903340e955913b9b675e28fd278dfd70803d Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Sun, 21 Jun 2020 21:16:13 +0200 Subject: [PATCH] refactor: use getSeasonNumber helper in MatchTransformer --- server/app/Transformers/MatchTransformer.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/server/app/Transformers/MatchTransformer.js b/server/app/Transformers/MatchTransformer.js index 9c4fe75..d00b946 100644 --- a/server/app/Transformers/MatchTransformer.js +++ b/server/app/Transformers/MatchTransformer.js @@ -2,7 +2,7 @@ const Jax = use('App/Services/Jax') const RoleIdentificationService = use('App/Services/RoleIdentificationService') -const { queuesWithRole, sortTeamByRole } = use('App/helpers') +const { getSeasonNumber, queuesWithRole, sortTeamByRole } = use('App/helpers') /** * MatchTransformer class @@ -28,12 +28,6 @@ class MatchTransformer { this.summonerSpells = summonerSpells this.championRoles = championRoles this.sortTeamByRole = sortTeamByRole - - // League of Legends seasons timestamps - this.seasons = { - 0: 9, - 1578628800000: 10 - } } /** @@ -51,19 +45,12 @@ class MatchTransformer { * Get global data about the match */ getGameInfos(match) { - // Get season number - const arrSeasons = Object.keys(this.seasons) - arrSeasons.push(match.gameCreation) - arrSeasons.sort() - const indexSeason = arrSeasons.indexOf(match.gameCreation) - 1 - const season = this.seasons[arrSeasons[indexSeason]] - return { map: match.mapId, gamemode: match.queueId, date: match.gameCreation, region: match.platformId.toLowerCase(), - season, + season: getSeasonNumber(match.gameCreation), time: match.gameDuration } }