mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 21:07:27 +00:00
fix: check summoner friends with account_id instead of name
This commit is contained in:
parent
cbd66f1a3b
commit
304ed03ace
4 changed files with 22 additions and 11 deletions
|
|
@ -23,9 +23,9 @@
|
||||||
class="flex justify-between items-center"
|
class="flex justify-between items-center"
|
||||||
>
|
>
|
||||||
<router-link
|
<router-link
|
||||||
:to="{ name: 'summoner', params: { region: $route.params.region, name: mate._id }}"
|
:to="{ name: 'summoner', params: { region: $route.params.region, name: mate.name }}"
|
||||||
class="w-2/4 hover:text-teal-200"
|
class="w-2/4 hover:text-teal-200"
|
||||||
>{{ mate._id }}</router-link>
|
>{{ mate.name }}</router-link>
|
||||||
<div class="w-1/4">{{ mate.wins }} / {{ mate.losses }}</div>
|
<div class="w-1/4">{{ mate.wins }} / {{ mate.losses }}</div>
|
||||||
<div class="w-1/4">
|
<div class="w-1/4">
|
||||||
<Dropdown>
|
<Dropdown>
|
||||||
|
|
|
||||||
|
|
@ -156,23 +156,32 @@ class MatchRepository {
|
||||||
/**
|
/**
|
||||||
* Get Summoner's mates list
|
* Get Summoner's mates list
|
||||||
* @param puuid of the summoner
|
* @param puuid of the summoner
|
||||||
* @param summonerName of the summoner
|
|
||||||
*/
|
*/
|
||||||
mates(puuid, summonerName) {
|
mates(puuid) {
|
||||||
const intermediateSteps = [
|
const intermediateSteps = [
|
||||||
{ $unwind: "$allyTeam" },
|
{ $unwind: "$allyTeam" },
|
||||||
]
|
]
|
||||||
|
const groupParams = {
|
||||||
|
account_id: { $first: "$account_id" },
|
||||||
|
name: { $first: "$allyTeam.name" },
|
||||||
|
mateId: { $first: "$allyTeam.account_id" },
|
||||||
|
}
|
||||||
const finalSteps = [
|
const finalSteps = [
|
||||||
{
|
{
|
||||||
$match: {
|
"$addFields": {
|
||||||
_id: { $not: { $eq: summonerName } },
|
"idEq": { "$eq": ["$mateId", "$account_id"] }
|
||||||
'count': { $gte: 2 }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
'idEq': false,
|
||||||
|
'count': { $gte: 2 }
|
||||||
|
},
|
||||||
|
},
|
||||||
{ $sort: { 'count': -1 } },
|
{ $sort: { 'count': -1 } },
|
||||||
{ $limit: 15 },
|
{ $limit: 15 },
|
||||||
]
|
]
|
||||||
return this._aggregate(puuid, {}, intermediateSteps, '$allyTeam.name', {}, finalSteps)
|
return this._aggregate(puuid, {}, intermediateSteps, '$allyTeam.account_id', groupParams, finalSteps)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class StatsService {
|
||||||
}
|
}
|
||||||
const championStats = await this.matchRepository.championStats(account.puuid, 5)
|
const championStats = await this.matchRepository.championStats(account.puuid, 5)
|
||||||
const championClassStats = await this.matchRepository.championClassStats(account.puuid)
|
const championClassStats = await this.matchRepository.championClassStats(account.puuid)
|
||||||
const mates = await this.matchRepository.mates(account.puuid, account.name)
|
const mates = await this.matchRepository.mates(account.puuid)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
global: globalStats[0],
|
global: globalStats[0],
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ class BasicMatchTransformer extends MatchTransformer {
|
||||||
// Global data about the match
|
// Global data about the match
|
||||||
const globalInfos = super.getGameInfos(match)
|
const globalInfos = super.getGameInfos(match)
|
||||||
|
|
||||||
const participantId = match.participantIdentities.find((p) => p.player.currentAccountId === account.accountId).participantId
|
const identity = match.participantIdentities.find((p) => p.player.currentAccountId === account.accountId)
|
||||||
const player = match.participants[participantId - 1]
|
const player = match.participants[identity.participantId - 1]
|
||||||
|
|
||||||
let win = match.teams.find((t) => t.teamId === player.teamId).win
|
let win = match.teams.find((t) => t.teamId === player.teamId).win
|
||||||
|
|
||||||
|
|
@ -53,6 +53,7 @@ class BasicMatchTransformer extends MatchTransformer {
|
||||||
for (let summoner of match.participantIdentities) {
|
for (let summoner of match.participantIdentities) {
|
||||||
const allData = match.participants[summoner.participantId - 1]
|
const allData = match.participants[summoner.participantId - 1]
|
||||||
const playerInfos = {
|
const playerInfos = {
|
||||||
|
account_id: summoner.player.currentAccountId,
|
||||||
name: summoner.player.summonerName,
|
name: summoner.player.summonerName,
|
||||||
role: super.getRoleName(allData.timeline),
|
role: super.getRoleName(allData.timeline),
|
||||||
champion: super.getChampion(allData.championId)
|
champion: super.getChampion(allData.championId)
|
||||||
|
|
@ -68,6 +69,7 @@ class BasicMatchTransformer extends MatchTransformer {
|
||||||
enemyTeam.sort(this.sortTeamByRole)
|
enemyTeam.sort(this.sortTeamByRole)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
account_id: identity.player.currentAccountId,
|
||||||
summoner_puuid: account.puuid,
|
summoner_puuid: account.puuid,
|
||||||
gameId: match.gameId,
|
gameId: match.gameId,
|
||||||
result: win,
|
result: win,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue