sendou.ink/app/features/mmr/queries/findCurrentTeamSkillByIdentifier.server.ts
Kalle c0ec15b7de
Some checks failed
Tests and checks on push / run-checks-and-tests (push) Has been cancelled
Updates translation progress / update-translation-progress-issue (push) Has been cancelled
Unify db type files
2025-03-21 21:47:08 +02:00

33 lines
592 B
TypeScript

import { sql } from "~/db/sql";
import type { Tables } from "~/db/tables";
const stm = sql.prepare(/* sql */ `
select
"mu",
"sigma",
"matchesCount"
from
"Skill"
where
"id" = (
select max("id")
from "Skill"
where "identifier" = @identifier
and "season" = @season
group by "identifier"
)
`);
export function findCurrentTeamSkillByIdentifier({
identifier,
season,
}: {
identifier: string;
season: number;
}) {
return stm.get({ identifier, season }) as Pick<
Tables["Skill"],
"mu" | "sigma" | "matchesCount"
> | null;
}