mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-27 14:04:01 -05:00
* Initial * CSS lint * Test CI * Add 1v1, 2v2, and 3v3 Tags (#1771) * Initial * CSS lint * Test CI * Rename step --------- Co-authored-by: xi <104683822+ximk@users.noreply.github.com>
26 lines
486 B
TypeScript
26 lines
486 B
TypeScript
import { sql } from "~/db/sql";
|
|
|
|
const stm = sql.prepare(/* sql */ `
|
|
select
|
|
(sum("setWins") / 4) as "wins",
|
|
(sum("setLosses") / 4) as "losses"
|
|
from
|
|
"PlayerResult"
|
|
where
|
|
"ownerUserId" = @userId
|
|
and "season" = @season
|
|
and "type" = 'ENEMY'
|
|
group by
|
|
"ownerUserId"
|
|
`);
|
|
|
|
export function seasonSetWinrateByUserId({
|
|
userId,
|
|
season,
|
|
}: {
|
|
userId: number;
|
|
season: number;
|
|
}): { wins: number; losses: number } {
|
|
return stm.get({ userId, season }) as any;
|
|
}
|