Skip to content

Image export · Modules

2 modules · 14 exports · 0 repositories · 0 e2e tests · 0 routes

Who imports who · hover a node
Depends onImage export modulesUsed bySeasonsmmrRunComps3 exportsSeasonSummary11 exportsLoaders3 filesComponents1 fileRoutes1 file

RunComps

app/features/img-export/core/RunComps.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
1 loader1 component

Types

interface

CompObservation

no JSDoc:8
export interface CompObservation {
	/** User id when known, otherwise the ingested scoreboard name */
	playerKey: string;
	weaponSplId: MainWeaponId;
	/** Chronological index of the map the weapon was played in */
	mapOrder: number;
}

Functions & values

function

buildComp

:20

Each player contributes their most played weapon (ties: most recent). Weapon id order, Tacticooler weapons last. Over {@link COMP_SIZE} players, the ones with the most maps make the comp.

export function buildComp(observations: CompObservation[]): MainWeaponId[]
Unit tests (5)
function

mapObservations

:46

One map's reported and ingested weapon rows as observations. Ingested rows duplicating a report are dropped (same user, or an unlinked row whose weapon a report already covers, as a multiset).

export function mapObservations({
	mapOrder,
	reported,
	ingested,
}: {
	mapOrder: number;
	reported: Array<{ userId: number; weaponSplId: MainWeaponId }>;
	ingested: Array<{
		name: string;
		userId?: number;
		weaponSplId: MainWeaponId | null;
	}>;
}): CompObservation[]
Unit tests (4)

SeasonSummary

app/features/img-export/core/SeasonSummary.ts

No overview comment at the top of the file.

Imports
Seasons
Used by
2 loaders1 route

Types

interface

SetScore

no JSDoc:16
export interface SetScore {
	ownScore: number;
	opponentScore: number;
}
Only used inside the module
interface

TournamentRun

no JSDoc:148
export interface TournamentRun {
	/** 1 = X (best) … 9 = C. Null (no calculated tier) ranks below every tiered tournament. */
	tier: number | null;
	placement: number;
	teamsCount: number;
	/** Average end of season SP of the top 8 placers; null when none had a calculated skill. */
	topEightAvgSp: number | null;
}
Only used inside the module

Functions & values

function

longestWinStreak

:22

Longest run of consecutive set wins; sets must be in chronological order.

export function longestWinStreak(sets: SetScore[]): number
Unit tests (4)
function

clutchRecord

:39

Win record in sets decided by one map (4-3 in SendouQ, 2-1/3-2 in tournaments).

export function clutchRecord(sets: SetScore[]): { won: number; total: number }
Unit tests (2)
function

bestStage

:52

Best winrate stage across modes; stages under the maps-played threshold are excluded so a lucky 2-0 can't win.

export function bestStage(
	stages: Partial<
		Record<
			StageId,
			Partial<Record<ModeShort, { wins: number; losses: number }>>
		>
	>,
): { stageId: StageId; winratePercentage: number } | undefined
Unit tests (4)
function

mostPlayedStage

:83

Stage with the most maps played across modes, higher winrate breaking ties; undefined when no maps were played.

export function mostPlayedStage(
	stages: Partial<
		Record<
			StageId,
			Partial<Record<ModeShort, { wins: number; losses: number }>>
		>
	>,
): { stageId: StageId; winratePercentage: number } | undefined
Unit tests (3)
function

topModeUsage

:117

Mode with the most maps played across stages, with its share of all maps played; null when no maps were played.

export function topModeUsage(
	stages: Partial<
		Record<
			StageId,
			Partial<Record<ModeShort, { wins: number; losses: number }>>
		>
	>,
): { mode: ModeShort; usagePercentage: number } | null
Unit tests (2)
function

bestTournamentRun

:169

The best tournament run by {@link tournamentRunScore}.

export function bestTournamentRun<T extends TournamentRun>(
	runs: T[],
): T | undefined
Unit tests (3)
function

topWeaponUsages

:176

Most used weapons with their share of all reported weapon occurrences, most used first.

export function topWeaponUsages(
	reportedWeapons: Array<{ weaponSplId: MainWeaponId; count: number }>,
): Array<{ weaponSplId: MainWeaponId; usagePercentage: number }>
Unit tests (2)
function

isSeasonFinished

:192

Whether the season has ended.

export function isSeasonFinished(season: number, date = new Date())
function

canExportSeasonSummary

:207

Only the profile owner can export, with a non-approximate skill for a finished season. Supporters can export any finished season, others only per {@link isSeasonExportableByAll}.

export function canExportSeasonSummary({
	loggedInUser,
	profileUserId,
	season,
	seasonsParticipatedIn,
	hasCalculatedSkill,
	date = new Date(),
}: {
	loggedInUser?: { id: number; roles: Role[] };
	profileUserId: number;
	season: number;
	seasonsParticipatedIn: number[];
	hasCalculatedSkill: boolean;
	date?: Date;
}): boolean
Unit tests (9)
Unit tests not about one export (8)

Not shown, only used by tests: tournamentRunScore, isSeasonExportableByAll