Skip to content

User activity · Modules

1 module · 3 exports · 0 repositories · 0 e2e tests · 0 routes

Who imports who · hover a node
Depends onUser activity modulesUsed bySendouQ.serversendouqRunningTournaments.serverUserActivity.server3 ex…Routes1 fileOther2 files

UserActivity

serverapp/features/user-activity/core/UserActivity.server.ts

No overview comment at the top of the file.

Imports
SendouQ.serverRunningTournaments.server
Used by
1 route2 other

Types

interface

UserActivity

no JSDoc:9
export interface UserActivity {
	/** The user's SendouQ group (never INACTIVE), with its pending received likes and expiry resolved. */
	sendouq: {
		group: NonNullable<ReturnType<(typeof SendouQ)["findOwnGroup"]>>;
		likesReceivedCount: number;
		expired: boolean;
	} | null;
	/** The user's status in every running tournament they are playing, in registry order. Leagues are not activity: their matches run over days, not something the user is doing right now. */
	tournaments: Array<{
		tournament: Tournament;
		status: TournamentTeamMemberProgressStatus;
	}>;
}

Functions & values

function

resolve

:29

Resolves everything the user is doing right now (SendouQ + running tournaments) from in-memory state, no DB reads. The single source shared by the friends sidebar, the public active-match API and the header status indicator; each consumer applies its own priority order.

export function resolve(userId: number): UserActivity
Unit tests (7)
const

TOURNAMENT_STATUS_IS_IN_PROGRESS

:55

Whether a tournament progress status counts as "playing right now". CHECKIN is in-progress for the user themself; the friends projection drops it as a friend needing to check in is not watchable activity.

export const TOURNAMENT_STATUS_IS_IN_PROGRESS: Record<
	TournamentTeamMemberProgressStatus["type"],
	boolean
> = {
	MATCH: true,
	WAITING_FOR_MATCH: true,
	WAITING_FOR_CAST: true,
	WAITING_FOR_ROUND: true,
	WAITING_FOR_GROUPS: true,
	CHECKIN: true,
	// to counter 2 day tournaments showing as in progress in between
	WAITING_FOR_BRACKET: false,