mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
fix: no tanks played now does not display a total
This commit is contained in:
1 parent
d8ac0b2ef6
commit
dd0644e09f
1 file changed
+11
-6
+11
-6
@@ -20,12 +20,11 @@ import { AccountInfo, AllStats } from '../types/accountInfo.js';
|
|||||||
import { PlayerClanData } from '../types/playerClanData.js';
|
import { PlayerClanData } from '../types/playerClanData.js';
|
||||||
import { PossiblyPromise } from '../types/possiblyPromise.js';
|
import { PossiblyPromise } from '../types/possiblyPromise.js';
|
||||||
|
|
||||||
// TODO: sort tanks by last played
|
|
||||||
export default async function today({ server, id }: ResolvedPlayer) {
|
export default async function today({ server, id }: ResolvedPlayer) {
|
||||||
const { diffed, order } = await getDiffedTankStats(
|
const { diffed, order } = await getDiffedTankStats(
|
||||||
server,
|
server,
|
||||||
id,
|
id,
|
||||||
getTimeDaysAgo(0),
|
getTimeDaysAgo(server, 1),
|
||||||
getPeriodNow(),
|
getPeriodNow(),
|
||||||
);
|
);
|
||||||
const accountInfo = await getWargamingResponse<AccountInfo>(
|
const accountInfo = await getWargamingResponse<AccountInfo>(
|
||||||
@@ -111,7 +110,8 @@ export default async function today({ server, id }: ResolvedPlayer) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const rows = await Promise.all(
|
const rows = await Promise.all(
|
||||||
[0, ...order].map(async (tankId, index) => {
|
[...(order.length === 0 ? [] : [0]), ...order].map(
|
||||||
|
async (tankId, index) => {
|
||||||
const tankStats = diffed[tankId];
|
const tankStats = diffed[tankId];
|
||||||
const career = careerStats[tankId];
|
const career = careerStats[tankId];
|
||||||
|
|
||||||
@@ -124,17 +124,22 @@ export default async function today({ server, id }: ResolvedPlayer) {
|
|||||||
winrate={tankStats.wins / tankStats.battles}
|
winrate={tankStats.wins / tankStats.battles}
|
||||||
careerWinrate={career.wins / career.battles}
|
careerWinrate={career.wins / career.battles}
|
||||||
WN8={isNaN(todayWN8s[tankId]) ? undefined : todayWN8s[tankId]}
|
WN8={isNaN(todayWN8s[tankId]) ? undefined : todayWN8s[tankId]}
|
||||||
careerWN8={isNaN(careerWN8s[tankId]) ? undefined : careerWN8s[tankId]}
|
careerWN8={
|
||||||
|
isNaN(careerWN8s[tankId]) ? undefined : careerWN8s[tankId]
|
||||||
|
}
|
||||||
damage={tankStats.damage_dealt / tankStats.battles}
|
damage={tankStats.damage_dealt / tankStats.battles}
|
||||||
careerDamage={career.damage_dealt / career.battles}
|
careerDamage={career.damage_dealt / career.battles}
|
||||||
battles={tankStats.battles}
|
battles={tankStats.battles}
|
||||||
careerBattles={career.battles}
|
careerBattles={career.battles}
|
||||||
icon={
|
icon={
|
||||||
tankId === 0 ? undefined : (await tankopedia)[tankId]?.images.normal
|
tankId === 0
|
||||||
|
? undefined
|
||||||
|
: (await tankopedia)[tankId]?.images.normal
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in new issue
Block a user