Exclude round one records from match history and statistics

This commit is contained in:
2026-09-21 18:07:30 -04:00
parent 50c81456c4
commit 424d6cefb6
12 changed files with 120 additions and 24 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
import { db } from '../db/index.js';
import type { ServerMatch } from '../../match-history.js';
import { MIN_RECORDED_ROUND, type ServerMatch } from '../../match-history.js';
export function serverMatchHistory(server?: string, limit = 25): { matches: ServerMatch[]; total: number } {
const handle = db();
const where = server === undefined ? '' : 'WHERE m.server = ?';
const where = `WHERE m.highest_round >= ${MIN_RECORDED_ROUND}${server === undefined ? '' : ' AND m.server = ?'}`;
const parameters = server === undefined ? [] : [server];
const total = (handle.prepare(`SELECT COUNT(*) AS total FROM leaderboard_matches m ${where}`).get(...parameters) as { total: number }).total;
const matches = handle.prepare(`SELECT m.id, m.server, m.map_name AS map, m.started_at AS startedAt, m.status,