[WarStatsPage] show the number of villages that each side has
This commit is contained in:
parent
0f1e18b51d
commit
7f1f66b9e0
|
@ -80,6 +80,15 @@ function WarStatsPage() {
|
|||
players: Player[] = [],
|
||||
tribes: Tribe[] = []
|
||||
): SideResult => {
|
||||
let totalVillages = 0;
|
||||
tribes.forEach(t => {
|
||||
totalVillages += t.totalVillages;
|
||||
});
|
||||
players
|
||||
.filter(p => !p.tribe || !tribes.some(t => t.id === p.tribe?.id))
|
||||
.forEach(p => {
|
||||
totalVillages += p.totalVillages;
|
||||
});
|
||||
return {
|
||||
gained: totalGained,
|
||||
lost: totalLost,
|
||||
|
@ -87,6 +96,7 @@ function WarStatsPage() {
|
|||
difference: totalGained - totalLost,
|
||||
players,
|
||||
tribes,
|
||||
totalVillages,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -52,6 +52,10 @@ function OneSideResult({ data, t, server, title }: Props) {
|
|||
))}
|
||||
</Typography>
|
||||
)}
|
||||
<Typography>
|
||||
{t('results.villages')}:{' '}
|
||||
<strong>{formatNumber('commas', data.totalVillages)}</strong>
|
||||
</Typography>
|
||||
<Typography>
|
||||
{t('results.gained')}:{' '}
|
||||
<strong>{formatNumber('commas', data.gained)}</strong>
|
||||
|
|
|
@ -18,6 +18,10 @@ export const PLAYERS = gql`
|
|||
items {
|
||||
id
|
||||
name
|
||||
totalVillages
|
||||
tribe {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +45,7 @@ export const TRIBES = gql`
|
|||
items {
|
||||
id
|
||||
tag
|
||||
totalVillages
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import { List, EnnoblementFilter } from '@libs/graphql/types';
|
|||
export type Tribe = {
|
||||
id: number;
|
||||
tag: string;
|
||||
totalVillages: number;
|
||||
};
|
||||
|
||||
export type TribeList = {
|
||||
|
@ -12,6 +13,10 @@ export type TribeList = {
|
|||
export type Player = {
|
||||
id: number;
|
||||
name: string;
|
||||
totalVillages: number;
|
||||
tribe?: {
|
||||
id: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type PlayerList = {
|
||||
|
@ -68,6 +73,7 @@ export type SideResult = {
|
|||
againstOppositeSide: number;
|
||||
players: Player[];
|
||||
tribes: Tribe[];
|
||||
totalVillages: number;
|
||||
};
|
||||
|
||||
export type Results = {
|
||||
|
|
Reference in New Issue
Block a user