8단계 관리자: 노래 추가·초성 검색·일괄 작업·휴지통·가져오기/내보내기·중복 병합·하이라이트 지정, 가수 별칭, 장르, 통계와 난이도 제안, 방 강제 종료, 수집 실행/멈추기, 새 방 기본 설정·잠금 + 출제 기록(song_plays)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-18 22:27:21 +09:00
parent 7266fc8d25
commit 4165712fac
23 changed files with 2367 additions and 105 deletions

View File

@@ -85,6 +85,7 @@ export class Game {
private timer: ReturnType<typeof setInterval> | null = null;
/** Songs this game asked, for the room's "last 3 games" list. */
private asked: number[] = [];
readonly gameId = crypto.randomUUID();
constructor(
private room: Room,
@@ -314,6 +315,14 @@ export class Game {
});
this.room.quiz.played.push(s.id);
this.asked.push(s.id);
try {
// 통계 (admin): never let a stats write break the game.
this.room.deps.db
.query('INSERT INTO song_plays (song_id, game_id, played_at, players, winner_id, ms, how) VALUES (?, ?, ?, ?, ?, ?, ?)')
.run(s.id, this.gameId, now, Math.max(1, this.active().length), winner, ms, how === 'end' ? 'timeout' : how);
} catch {
/* stats only */
}
const answer = `${s.title} - ${s.artist}`;
if (winner) this.room.post({ userId: winner, text: chat!.text, n: chat!.n, answer: { text: answer } });
else this.room.post({ userId: null, text: how === 'skip' ? '스킵했어요 · 정답자 없음' : '시간이 다 됐어요 · 정답자 없음', answer: { text: answer, none: true } });