Skip to content

Match profile · Modules

2 modules · 9 exports · 1 repository · 0 e2e tests · 0 routes

Who imports who · hover a node
Depends onMatch profile modulesUsed byMapVotes1 exportMapWinRates8 exportsLobbyMapList.serverlobb…SendouQ.serversendouqComponents1 file

MapVotes

app/features/match-profile/core/MapVotes.ts

Votes of a player's match profile for the maps of their matches: SendouQ and lobby map lists are picked from the players' map pools, and a match shows who voted for the map being played.

Imports
no other modules
Used by
2 modules

Functions & values

function

votesFor

:9

The map is in the player's pool, of a mode they don't avoid.

export function votesFor(
	preferences: UserMapModePreferences,
	map: ModeWithStage,
): boolean
Unit tests (1)

MapWinRates

app/features/match-profile/core/MapWinRates.ts

A player's SendouQ win rates per mode and stage, shown next to the map pool preferences of their match profile so they can pick maps they do well on. Records are summed from the per-stage map results of recent seasons, small samples are flagged as tentative and each win rate is drawn as a bar growing from an even 50%.

Imports
no other modules
Used by
1 component

Types

type

MapResult

:16

Maps won and lost by a player on one stage of a mode.

export type MapResult = {
	mode: ModeShort;
	stageId: StageId;
	wins: number;
	losses: number;
};
type

WinLoss

:24

A record of maps won and lost.

export type WinLoss = Pick<MapResult, "wins" | "losses">;
type

SortOrder

:27

How stages are ordered in the picker: as listed, best win rate first or worst first.

export type SortOrder = "DEFAULT" | "BEST" | "WORST";

Functions & values

function

record

:30

Sums the records of a mode, or of one stage in it when stageId is given.

export function record(
	results: MapResult[],
	{ mode, stageId }: { mode: ModeShort; stageId?: StageId },
): WinLoss
Unit tests (3)
function

rate

:48

Share of maps won between 0 and 1, null when none were played.

export function rate({ wins, losses }: WinLoss): number | null
Unit tests (1)
function

isLowSample

:56

Whether too few maps were played for the win rate to mean much.

export function isLowSample({ wins, losses }: WinLoss)
Unit tests (1)
function

sortStages

:64

Orders stages of a mode by win rate. DEFAULT keeps the given order; otherwise ties go to the stage with more maps played and stages without maps come last, in their given order.

export function sortStages({
	stageIds,
	results,
	mode,
	order,
}: {
	stageIds: readonly StageId[];
	results: MapResult[];
	mode: ModeShort;
	order: SortOrder;
}): StageId[]
Unit tests (1)
function

barSegment

:103

Where the bar of a win rate goes on a track centered on 50%, both in percent of the track. It grows right of the center for winning records and left for losing ones; 75% and 25% (or beyond) fill their half.

export function barSegment(winRate: number)
Unit tests (1)