fix: matchlist order

This commit is contained in:
Kalane 2021-09-14 16:39:25 +02:00
parent 134cbfad0b
commit e3f6103a0d
2 changed files with 5 additions and 6 deletions

View file

@ -70,7 +70,9 @@ class MatchParser {
console.log('CHAMPION ID NOT FOUND: ' + player.championId)
console.log('FROM MATCH ' + match.metadata.matchId)
const championId = Object.keys(CDragonService.champions).find(
(key) => CDragonService.champions[key].name === player.championName
(key) =>
CDragonService.champions[key].name === player.championName ||
CDragonService.champions[key].alias === player.championName
)
player.championId = championId ? Number(championId) : 1
console.log('CHAMPION ID FROM NAME : ' + championId)

View file

@ -43,10 +43,7 @@ class MatchService {
public async updateMatchList(account: SummonerDTO, summonerDB: Summoner): Promise<MatchlistDto> {
console.time('matchList')
const currentMatchList = await summonerDB
.related('matchList')
.query()
.orderBy('matchId', 'desc')
const currentMatchList = await summonerDB.related('matchList').query().orderBy('matchId', 'asc')
const currentMatchListIds = currentMatchList.map((m) => m.matchId)
const newMatchList = await this._fetchMatchListUntil(account, (newMatchList: MatchlistDto) => {
@ -72,7 +69,7 @@ class MatchService {
}
console.timeEnd('matchList')
return currentMatchListIds
return currentMatchListIds.reverse()
}
/**