mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
fix: first time tank deltas
This commit is contained in:
1 parent
15bec37a33
commit
ea1eeb4366
2 files changed
+7
-6
No files matched your search
@@ -46,7 +46,6 @@ import { tankAverages } from '../../../core/blitzstars/tankAverages';
|
||||
import { deltaTankStats } from '../../../core/statistics/deltaTankStats';
|
||||
import { useWideFormat } from '../../../hooks/useWideFormat';
|
||||
import { theme } from '../../../stitches.config';
|
||||
import { useApp } from '../../../stores/app';
|
||||
import mutateSession, {
|
||||
SessionTracking,
|
||||
useSession,
|
||||
@@ -64,7 +63,6 @@ export default function Page() {
|
||||
useState(false);
|
||||
const input = useRef<HTMLInputElement>(null);
|
||||
const session = useSession();
|
||||
const login = useApp((state) => state.login);
|
||||
const [tankStatsB, setTankStatsB] = useState<IndividualTankStats[] | null>(
|
||||
null,
|
||||
);
|
||||
@@ -83,7 +81,7 @@ export default function Page() {
|
||||
const delta = useMemo(
|
||||
() =>
|
||||
session.tracking && tankStatsB
|
||||
? deltaTankStats(session.player.stats, tankStatsB)
|
||||
? deltaTankStats([], tankStatsB)
|
||||
.sort((a, b) => b.last_battle_time - a.last_battle_time)
|
||||
.map((entry) => {
|
||||
const tank = awaitedTankDefinitions[entry.tank_id];
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { IndividualTankStats } from '../../types/tanksStats';
|
||||
import {
|
||||
emptyIndividualTankStats,
|
||||
IndividualTankStats,
|
||||
} from '../../types/tanksStats';
|
||||
|
||||
export function deltaTankStats(
|
||||
tanksA: IndividualTankStats[],
|
||||
@@ -6,8 +9,8 @@ export function deltaTankStats(
|
||||
) {
|
||||
return tanksB
|
||||
.map((b) => {
|
||||
const a = tanksA.find((a) => a.tank_id === b.tank_id);
|
||||
if (!a) return null;
|
||||
const a =
|
||||
tanksA.find((a) => a.tank_id === b.tank_id) ?? emptyIndividualTankStats;
|
||||
|
||||
return {
|
||||
account_id: b.account_id,
|
||||
|
||||
Reference in new issue
Block a user