mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
feat(champions): add filter by gamemode back
This commit is contained in:
parent
80534a5ca3
commit
5c79f04563
5 changed files with 25 additions and 7 deletions
|
|
@ -36,12 +36,12 @@ export default {
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
// Show all queues when loading the page
|
// Show all queues when loading the page
|
||||||
this.queue = -1
|
this.queue = 0
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
// Reload all champions stats for next user visit of the champions tab
|
// Reload all champions stats for next user visit of the champions tab
|
||||||
if (this.queue !== -1)
|
if (this.queue !== 0)
|
||||||
this.championsNotLoaded()
|
this.championsNotLoaded()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ export const state = {
|
||||||
ranked: {},
|
ranked: {},
|
||||||
recentActivity: [],
|
recentActivity: [],
|
||||||
seasons: [],
|
seasons: [],
|
||||||
|
gamemodes: [],
|
||||||
status: '',
|
status: '',
|
||||||
},
|
},
|
||||||
overview: {
|
overview: {
|
||||||
|
|
@ -93,6 +94,7 @@ export const mutations = {
|
||||||
state.basic.ranked = infos.ranked
|
state.basic.ranked = infos.ranked
|
||||||
state.basic.recentActivity = infos.recentActivity
|
state.basic.recentActivity = infos.recentActivity
|
||||||
state.basic.seasons = infos.seasons.sort((a, b) => b - a)
|
state.basic.seasons = infos.seasons.sort((a, b) => b - a)
|
||||||
|
state.basic.gamemodes = infos.gamemodes
|
||||||
state.basic.status = 'found'
|
state.basic.status = 'found'
|
||||||
state.live.match = infos.current
|
state.live.match = infos.current
|
||||||
state.live.playing = infos.playing
|
state.live.playing = infos.playing
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export default {
|
||||||
const queues = Object.keys(gameModes)
|
const queues = Object.keys(gameModes)
|
||||||
.filter(gameMode =>
|
.filter(gameMode =>
|
||||||
gameModes[gameMode].type !== 'Bot' &&
|
gameModes[gameMode].type !== 'Bot' &&
|
||||||
this.matchList.find(match => match.queue === Number(gameMode))
|
this.gamemodes.includes(Number(gameMode))
|
||||||
)
|
)
|
||||||
.reduce((obj, key) => {
|
.reduce((obj, key) => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -52,13 +52,13 @@ export default {
|
||||||
[key]: gameModes[key]
|
[key]: gameModes[key]
|
||||||
}
|
}
|
||||||
}, {})
|
}, {})
|
||||||
return { '-1': { type: 'Normal', name: 'All queues' }, ...queues }
|
return { '0': { type: 'Normal', name: 'All queues' }, ...queues }
|
||||||
},
|
},
|
||||||
...mapGetters('summoner', ['summonerFound']),
|
...mapGetters('summoner', ['summonerFound']),
|
||||||
...mapState({
|
...mapState({
|
||||||
champions: state => state.summoner.champions.list,
|
champions: state => state.summoner.champions.list,
|
||||||
championsLoaded: state => state.summoner.champions.championsLoaded,
|
championsLoaded: state => state.summoner.champions.championsLoaded,
|
||||||
matchList: state => state.summoner.basic.matchList
|
gamemodes: state => state.summoner.basic.gamemodes
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ export default {
|
||||||
},
|
},
|
||||||
filterByQueue(queue) {
|
filterByQueue(queue) {
|
||||||
queue = Number(queue)
|
queue = Number(queue)
|
||||||
this.queue = queue === -1 ? null : queue
|
this.queue = queue === 0 ? null : queue
|
||||||
this.championsRequest(this.queue)
|
this.championsRequest(this.queue)
|
||||||
},
|
},
|
||||||
updateSearch(search) {
|
updateSearch(search) {
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,11 @@ export default class SummonersController {
|
||||||
finalJSON.matchList = await MatchService.updateMatchList(account, region, summonerDB)
|
finalJSON.matchList = await MatchService.updateMatchList(account, region, summonerDB)
|
||||||
|
|
||||||
// All seasons the summoner has played
|
// All seasons the summoner has played
|
||||||
// TODO: check if there is a way to do that with V5...
|
|
||||||
finalJSON.seasons = await this.getSeasons(account.puuid)
|
finalJSON.seasons = await this.getSeasons(account.puuid)
|
||||||
|
|
||||||
|
// All gamemodes the summoner has played
|
||||||
|
finalJSON.gamemodes = (await MatchRepository.gamemodes(account.puuid)).map((g) => g.gamemode)
|
||||||
|
|
||||||
// CURRENT GAME
|
// CURRENT GAME
|
||||||
console.time('playing')
|
console.time('playing')
|
||||||
const currentGame = await Jax.Spectator.summonerID(account.id, region)
|
const currentGame = await Jax.Spectator.summonerID(account.id, region)
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,20 @@ class MatchRepository {
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async gamemodes(puuid: string) {
|
||||||
|
const query = `
|
||||||
|
SELECT DISTINCT
|
||||||
|
matches.gamemode
|
||||||
|
FROM
|
||||||
|
match_players
|
||||||
|
${this.JOIN_MATCHES}
|
||||||
|
WHERE
|
||||||
|
match_players.summoner_puuid = :puuid
|
||||||
|
`
|
||||||
|
const { rows } = await Database.rawQuery(query, { puuid })
|
||||||
|
return rows
|
||||||
|
}
|
||||||
|
|
||||||
public async seasons(puuid: string) {
|
public async seasons(puuid: string) {
|
||||||
const query = `
|
const query = `
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue