mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
feat: ratings stats
This commit is contained in:
1 parent
5f28b541e3
commit
ca3a1fbe3f
12 files changed
+117
-78
No files matched your search
@@ -23,11 +23,22 @@ export interface AllStats {
|
||||
dropped_capture_points: number;
|
||||
}
|
||||
|
||||
export interface SupplementaryStats {
|
||||
export interface SupplementaryStatsRandom {
|
||||
type: 'random';
|
||||
WN8?: number;
|
||||
tier?: number;
|
||||
}
|
||||
|
||||
export interface SupplementaryStatsRating {
|
||||
type: 'rating';
|
||||
score: number;
|
||||
delta: number;
|
||||
}
|
||||
|
||||
export type SupplementaryStats =
|
||||
| SupplementaryStatsRandom
|
||||
| SupplementaryStatsRating;
|
||||
|
||||
export interface ClanStats {
|
||||
spotted: number;
|
||||
max_frags_tank_id: number;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import { LEAGUES } from '../../constants/leagues';
|
||||
|
||||
export function getLeagueFromScore(score: number) {
|
||||
return LEAGUES.find(({ minScore }) => score >= minScore)!;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { TreeType } from '../../components/Tanks';
|
||||
import { SupplementaryStatsRandom } from '../blitz/getAccountInfo';
|
||||
import { tankDefinitions } from '../blitzkrieg/tankDefinitions';
|
||||
import { DiffedTankStats } from '../blitzstars/getStatsInPeriod';
|
||||
import { tankAverages } from '../blitzstars/tankAverages';
|
||||
@@ -50,6 +51,7 @@ export async function filterStats(
|
||||
0,
|
||||
);
|
||||
const supplementary = {
|
||||
type: 'random',
|
||||
WN8:
|
||||
filteredOrder.reduce<number>(
|
||||
(accumulator, id) =>
|
||||
@@ -68,7 +70,7 @@ export async function filterStats(
|
||||
: accumulator,
|
||||
0,
|
||||
) / battlesOfTanksWithTankDefinition,
|
||||
};
|
||||
} satisfies SupplementaryStatsRandom;
|
||||
|
||||
return { stats, supplementary, filteredOrder };
|
||||
}
|
||||
Reference in new issue
Block a user