mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 21:07:27 +00:00
fix: 404 from Riot API match-v5 + random summonerSpellIds
This commit is contained in:
parent
5a7c38281f
commit
f19efcbd19
6 changed files with 26 additions and 5 deletions
|
|
@ -35,13 +35,23 @@
|
||||||
></div>
|
></div>
|
||||||
<div class="flex flex-col justify-around ml-2">
|
<div class="flex flex-col justify-around ml-2">
|
||||||
<div
|
<div
|
||||||
|
v-if="data.summonerSpell1"
|
||||||
:style="{backgroundImage: `url(${data.summonerSpell1.icon})`}"
|
:style="{backgroundImage: `url(${data.summonerSpell1.icon})`}"
|
||||||
class="w-6 h-6 bg-center bg-cover rounded-md bg-blue-1000"
|
class="w-6 h-6 bg-center bg-cover rounded-md bg-blue-1000"
|
||||||
></div>
|
></div>
|
||||||
<div
|
<div
|
||||||
|
v-else
|
||||||
|
class="w-6 h-6 rounded-md bg-blue-1000"
|
||||||
|
></div>
|
||||||
|
<div
|
||||||
|
v-if="data.summonerSpell2"
|
||||||
:style="{backgroundImage: `url(${data.summonerSpell2.icon})`}"
|
:style="{backgroundImage: `url(${data.summonerSpell2.icon})`}"
|
||||||
class="w-6 h-6 bg-center bg-cover rounded-md bg-blue-1000"
|
class="w-6 h-6 bg-center bg-cover rounded-md bg-blue-1000"
|
||||||
></div>
|
></div>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
class="w-6 h-6 rounded-md bg-blue-1000"
|
||||||
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col justify-around ml-1">
|
<div class="flex flex-col justify-around ml-1">
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ export const mutations = {
|
||||||
state.basic.recentActivity = stats.recentActivity
|
state.basic.recentActivity = stats.recentActivity
|
||||||
state.overview.matchesLoading = false
|
state.overview.matchesLoading = false
|
||||||
state.overview.matches = [...state.overview.matches, ...newMatches]
|
state.overview.matches = [...state.overview.matches, ...newMatches]
|
||||||
state.overview.matchIndex += newMatches.length
|
state.overview.matchIndex += 10
|
||||||
state.overview.stats = stats
|
state.overview.stats = stats
|
||||||
state.champions.championsLoaded = false
|
state.champions.championsLoaded = false
|
||||||
state.records.recordsLoaded = false
|
state.records.recordsLoaded = false
|
||||||
|
|
|
||||||
|
|
@ -69,15 +69,17 @@ class MatchParser {
|
||||||
|
|
||||||
// Fix championId bug in older matches
|
// Fix championId bug in older matches
|
||||||
if (player.championId > 1000) {
|
if (player.championId > 1000) {
|
||||||
console.log('CHAMPION ID NOT FOUND: ' + player.championId)
|
|
||||||
console.log('FROM MATCH ' + match.metadata.matchId)
|
|
||||||
const championId = Object.keys(CDragonService.champions).find(
|
const championId = Object.keys(CDragonService.champions).find(
|
||||||
(key) =>
|
(key) =>
|
||||||
CDragonService.champions[key].name === player.championName ||
|
CDragonService.champions[key].name === player.championName ||
|
||||||
CDragonService.champions[key].alias === player.championName
|
CDragonService.champions[key].alias === player.championName
|
||||||
)
|
)
|
||||||
|
if (!championId) {
|
||||||
|
console.log(
|
||||||
|
`CHAMPION NOT FOUND AT ALL: ${player.championId} FROM: ${match.metadata.matchId}`
|
||||||
|
)
|
||||||
|
}
|
||||||
player.championId = championId ? Number(championId) : 1
|
player.championId = championId ? Number(championId) : 1
|
||||||
console.log('CHAMPION ID FROM NAME : ' + championId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const originalChampionData = CDragonService.champions[player.championId]
|
const originalChampionData = CDragonService.champions[player.championId]
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ export default class JaxRequest {
|
||||||
!this.endpoint.includes('summoner/v4/summoners/by-name') &&
|
!this.endpoint.includes('summoner/v4/summoners/by-name') &&
|
||||||
!this.endpoint.includes('match/v4/matchlists/by-account')
|
!this.endpoint.includes('match/v4/matchlists/by-account')
|
||||||
) {
|
) {
|
||||||
|
Logger.error(`URL ${url}: `)
|
||||||
Logger.error(`JaxRequest Error ${statusCode}: `, rest)
|
Logger.error(`JaxRequest Error ${statusCode}: `, rest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import MatchParser from 'App/Parsers/MatchParser'
|
||||||
import BasicMatchSerializer from 'App/Serializers/BasicMatchSerializer'
|
import BasicMatchSerializer from 'App/Serializers/BasicMatchSerializer'
|
||||||
import { SerializedMatch } from 'App/Serializers/SerializedTypes'
|
import { SerializedMatch } from 'App/Serializers/SerializedTypes'
|
||||||
import Match from 'App/Models/Match'
|
import Match from 'App/Models/Match'
|
||||||
|
import { notEmpty, tutorialQueues } from 'App/helpers'
|
||||||
|
|
||||||
class MatchService {
|
class MatchService {
|
||||||
/**
|
/**
|
||||||
|
|
@ -105,7 +106,9 @@ class MatchService {
|
||||||
/* If we have to store some matches in the db */
|
/* If we have to store some matches in the db */
|
||||||
if (matchesFromApi.length !== 0) {
|
if (matchesFromApi.length !== 0) {
|
||||||
// Transform raw matches data
|
// Transform raw matches data
|
||||||
const parsedMatches: any = await MatchParser.parse(matchesFromApi)
|
const parsedMatches: any = await MatchParser.parse(
|
||||||
|
matchesFromApi.filter(notEmpty).filter((m) => !tutorialQueues.includes(m.info.queueId))
|
||||||
|
)
|
||||||
|
|
||||||
// TODO: Serialize match from DB + put it in Redis + push it in "matches"
|
// TODO: Serialize match from DB + put it in Redis + push it in "matches"
|
||||||
const serializedMatches = BasicMatchSerializer.serialize(parsedMatches, puuid, true)
|
const serializedMatches = BasicMatchSerializer.serialize(parsedMatches, puuid, true)
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,11 @@ export const queuesWithRole = [
|
||||||
700, // Clash
|
700, // Clash
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* League of Legends tutorial queues
|
||||||
|
*/
|
||||||
|
export const tutorialQueues = [2000, 2010, 2020]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* League of Legends seasons timestamps
|
* League of Legends seasons timestamps
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue