퀴즈 파일 A단계: 관리자 → 퀴즈 '파일로 만들기'(.xlsx·.csv를 브라우저가 라이브러리 없이 읽음, 열 이름으로 링크·정답·설명·힌트·순번 인식, 시트 선택, 잘못된 링크·중복 영상 표시), 편집 화면 '파일에서 가져오기'(뒤에 추가·목록 바꾸기)·'엑셀로 내보내기'·빈 양식. 파일 곡은 적힌 값 그대로(DB 연결·검토 대기 없음). 곡별 힌트를 하나씩 보여 준 뒤 초성 힌트(자동은 N초마다, 투표는 한 번에 하나)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -246,3 +246,73 @@ test('검토 대기: a 전체공개 quiz sends new songs and differences to admi
|
||||
const again = await save({ items: (await api(s.base, `/api/admin/quizzes/${q.id}`, { cookie: sa })).body.quiz.items });
|
||||
expect(again.body.reviews.pending).toBe(0);
|
||||
});
|
||||
|
||||
test('파일로 만들기: values as written, hints by vote, never sent to 검토 대기; a game shows the own hint, then the 초성', async () => {
|
||||
start();
|
||||
const sa = await adminCookie(TEST_SUPERADMINS[0]);
|
||||
const fileItem = (p: Record<string, unknown>) => item({ fromFile: true, hints: [], ...p });
|
||||
const bad = await api(s.base, '/api/admin/quizzes/file', { method: 'POST', cookie: sa, body: JSON.stringify({ name: '빈 파일', items: [] }) });
|
||||
expect(bad.res.status).toBe(400);
|
||||
const r = await api(s.base, '/api/admin/quizzes/file', {
|
||||
method: 'POST',
|
||||
cookie: sa,
|
||||
body: JSON.stringify({
|
||||
name: '게임 BGM',
|
||||
items: [
|
||||
// the video is the DB song's, but a file song is not linked to it (no DB comparison)
|
||||
fileItem({ videoId: 'goodday0001', title: '리그 오브 레전드', artist: 'Still Here', hints: ['AOS(MOBA)'], songId: 5 }),
|
||||
fileItem({ videoId: 'nodesc00001', title: '원신', artist: '', hints: ['확인필요'] }),
|
||||
],
|
||||
}),
|
||||
});
|
||||
expect(r.res.status).toBe(200);
|
||||
const q = (await api(s.base, `/api/admin/quizzes/${r.body.id}`, { cookie: sa })).body.quiz;
|
||||
expect(q.settings.hint).toBe('manual');
|
||||
expect(q.items).toMatchObject([
|
||||
{ songId: null, title: '리그 오브 레전드', artist: 'Still Here', hints: ['AOS(MOBA)'], fromFile: true },
|
||||
{ songId: null, title: '원신', artist: '', hints: ['확인필요'], fromFile: true },
|
||||
]);
|
||||
// 전체공개 save: file songs stay out of 검토 대기, an editor song next to them does not
|
||||
const saved = await api(s.base, `/api/admin/quizzes/${q.id}`, {
|
||||
method: 'PUT',
|
||||
cookie: sa,
|
||||
body: JSON.stringify({ ...q, visibility: 'public', items: [...q.items, item({ videoId: 'editor00001', title: '직접 넣은 곡', artist: '가수' })] }),
|
||||
});
|
||||
expect(saved.res.status).toBe(200);
|
||||
expect(saved.body.reviews.pending).toBe(1);
|
||||
// an editor song still needs a singer
|
||||
const noArtist = await api(s.base, `/api/admin/quizzes/${q.id}`, { method: 'PUT', cookie: sa, body: JSON.stringify({ ...q, items: [item({ videoId: 'editor00002', title: '곡', artist: '' })] }) });
|
||||
expect(noArtist.res.status).toBe(400);
|
||||
|
||||
const code: string = (await api(s.base, '/api/rooms', { method: 'POST', cookie: sa, body: '{}' })).body.code;
|
||||
const cl = await new Client(s.base, sa).connect();
|
||||
cl.send({ t: 'join', code });
|
||||
await cl.waitFor((m) => m.t === 'room');
|
||||
cl.send({ t: 'config', patch: { quizId: q.id, hint: 'manual', hintVotes: '1' } });
|
||||
await cl.waitFor((m) => m.t === 'room' && m.room.config.quizId === q.id && m.room.config.hint === 'manual');
|
||||
let seen = 0;
|
||||
const iv = setInterval(() => {
|
||||
for (const m of cl.messages.slice(seen)) if (m.t === 'prepare') cl.send({ t: 'audio', n: m.n, ev: 'ready' });
|
||||
seen = cl.messages.length;
|
||||
}, 5);
|
||||
try {
|
||||
cl.send({ t: 'start' });
|
||||
const play = (await cl.waitFor((m) => m.t === 'play' && m.n === 1)) as Msg<'play'>;
|
||||
await sleep(Math.max(0, play.startAt - Date.now()) + 15);
|
||||
cl.send({ t: 'vote', kind: 'hint' });
|
||||
const g1 = (await cl.waitFor((m) => m.t === 'game' && !!m.game?.hints.length)) as Msg<'game'>;
|
||||
expect(g1.game!.hints).toEqual([{ text: 'AOS(MOBA)', chosung: false }]);
|
||||
expect(g1.game!.hintMore).toBe(true);
|
||||
cl.send({ t: 'vote', kind: 'hint' });
|
||||
const g2 = (await cl.waitFor((m) => m.t === 'game' && m.game?.hints.length === 2)) as Msg<'game'>;
|
||||
expect(g2.game!.hints[1]).toEqual({ text: 'ㄹㄱ ㅇㅂ ㄹㅈㄷ', chosung: true });
|
||||
expect(g2.game!.hint).toBe('AOS(MOBA) · ㄹㄱ ㅇㅂ ㄹㅈㄷ');
|
||||
expect(g2.game!.hintMore).toBe(false);
|
||||
cl.send({ t: 'chat', text: '리그 오브 레전드' });
|
||||
const ans = (await cl.waitFor((m) => m.t === 'answer')) as Msg<'answer'>;
|
||||
expect(ans.line.answer?.text).toBe('리그 오브 레전드 - Still Here');
|
||||
} finally {
|
||||
clearInterval(iv);
|
||||
cl.close();
|
||||
}
|
||||
});
|
||||
|
||||
4
apps/server/src/db/migrations/012_quiz_file.sql
Normal file
4
apps/server/src/db/migrations/012_quiz_file.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- 퀴즈 파일로 만들기: hints per song (shown one by one before the 초성 hint) and songs that came from a file
|
||||
-- (used as written, never sent to 검토 대기).
|
||||
ALTER TABLE custom_quiz_items ADD COLUMN hints TEXT NOT NULL DEFAULT '[]';
|
||||
ALTER TABLE custom_quiz_items ADD COLUMN from_file INTEGER NOT NULL DEFAULT 0;
|
||||
@@ -90,6 +90,8 @@ export class Game {
|
||||
private runningSince: number | null = null;
|
||||
private limitMs: number | null = null;
|
||||
hint: string | null = null;
|
||||
/** Hints shown in this question: the song's own (제작된 퀴즈) one by one, then the 초성 hint. */
|
||||
private shownHints: { text: string; chosung: boolean }[] = [];
|
||||
/** 통계: how the hint came (null = none), chat lines that were not the answer and who sent them, replays. */
|
||||
private stat = { hint: null as 'auto' | 'vote' | null, wrong: 0, wrongBy: new Set<string>(), replays: 0 };
|
||||
private lyrics: string[] | null = null;
|
||||
@@ -196,6 +198,7 @@ export class Game {
|
||||
this.elapsedMs = 0;
|
||||
this.runningSince = null;
|
||||
this.hint = null;
|
||||
this.shownHints = [];
|
||||
this.stat = { hint: null, wrong: 0, wrongBy: new Set(), replays: 0 };
|
||||
this.revealUntil = null;
|
||||
for (const v of Object.values(this.votes)) v.clear();
|
||||
@@ -288,13 +291,26 @@ export class Game {
|
||||
this.broadcast();
|
||||
}
|
||||
|
||||
/** Hints this song has: its own ones, then the 초성 hint. */
|
||||
private hintCount(): number {
|
||||
return (this.song?.hints?.length ?? 0) + 1;
|
||||
}
|
||||
private hintMore(): boolean {
|
||||
return !!this.song && this.shownHints.length < this.hintCount();
|
||||
}
|
||||
|
||||
/** The next hint: the song's own hints one by one, the 초성 hint last. */
|
||||
private showHint(how: 'auto' | 'vote' = 'auto'): void {
|
||||
if (this.hint || !this.song) return;
|
||||
this.stat.hint = how;
|
||||
this.hint = hintText(this.song, this.room.config.answer);
|
||||
if (this.lyrics && this.song.lyrics) this.lyrics = lyricsCard(this.song.lyrics, this.song.title, 1);
|
||||
if (!this.song || !this.hintMore()) return;
|
||||
this.stat.hint ??= how;
|
||||
const own = this.song.hints ?? [];
|
||||
const i = this.shownHints.length;
|
||||
const next = i < own.length ? { text: own[i]!, chosung: false } : { text: hintText(this.song, this.room.config.answer), chosung: true };
|
||||
this.shownHints.push(next);
|
||||
this.hint = this.shownHints.map((h) => h.text).join(' · ');
|
||||
if (next.chosung && this.lyrics && this.song.lyrics) this.lyrics = lyricsCard(this.song.lyrics, this.song.title, 1);
|
||||
this.votes.hint.clear();
|
||||
this.room.say(null, `힌트가 공개됐어요: ${this.hint}`);
|
||||
this.room.say(null, `${this.hintCount() > 1 ? `힌트 ${i + 1}` : '힌트'}가 공개됐어요: ${next.text}`);
|
||||
this.broadcast();
|
||||
}
|
||||
|
||||
@@ -417,7 +433,7 @@ export class Game {
|
||||
if (this.phase !== 'play') return;
|
||||
const el = this.elapsed(now);
|
||||
const c = this.room.config;
|
||||
if (typeof c.hint === 'number' && !this.hint && this.runningSince !== null && el >= c.hint * 1000) this.showHint();
|
||||
if (typeof c.hint === 'number' && this.hintMore() && this.runningSince !== null && el >= c.hint * 1000 * (this.shownHints.length + 1)) this.showHint();
|
||||
if (this.limitMs !== null && el >= this.limitMs) return this.endQuestion(null, 'timeout');
|
||||
if (this.playing && !this.clipOver && this.clip.endSec !== null) {
|
||||
const expectedEnd = this.audioStartAt + (this.clip.endSec - this.audioAtSec) * 1000;
|
||||
@@ -503,9 +519,9 @@ export class Game {
|
||||
const c = this.room.config;
|
||||
if (kind === 'hint') {
|
||||
if (c.hint === 'none') return '이 방은 힌트가 꺼져 있어요.';
|
||||
if (this.hint) return '이미 공개된 힌트예요.';
|
||||
if (!this.hintMore()) return this.hintCount() > 1 ? '힌트를 모두 공개했어요.' : '이미 공개된 힌트예요.';
|
||||
if (c.hint !== 'manual') {
|
||||
const left = Math.max(1, Math.ceil(c.hint - (this.elapsed() / 1000)));
|
||||
const left = Math.max(1, Math.ceil(c.hint * (this.shownHints.length + 1) - this.elapsed() / 1000));
|
||||
return `힌트는 ${left}초 뒤에 공개돼요.`;
|
||||
}
|
||||
}
|
||||
@@ -636,7 +652,9 @@ export class Game {
|
||||
clipSec: this.clip.endSec !== null ? this.clip.endSec - this.clip.startSec : null,
|
||||
clipOver: this.clipOver,
|
||||
hint: this.hint,
|
||||
hintAtSec: typeof c.hint === 'number' ? c.hint : null,
|
||||
hints: this.shownHints,
|
||||
hintMore: this.hintMore(),
|
||||
hintAtSec: typeof c.hint === 'number' && this.hintMore() ? c.hint * (this.shownHints.length + 1) : null,
|
||||
lyrics: this.lyrics,
|
||||
votes: { skip: [...this.votes.skip], hint: [...this.votes.hint], replay: [...this.votes.replay], next: [...this.votes.next] },
|
||||
need: { skip: this.need('skip'), hint: this.need('hint'), replay: this.need('replay'), next: this.need('next') },
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import type { Context, Hono } from 'hono';
|
||||
import { z } from 'zod';
|
||||
import { QuizSaveSchema, songMatchKey, type Role } from '@mq/shared';
|
||||
import { DEFAULT_QUIZ_SETTINGS, QuizSaveSchema, songMatchKey, type Role } from '@mq/shared';
|
||||
import type { Database } from 'bun:sqlite';
|
||||
import { CustomQuizzes, type QuizLimits } from '../quizzes/store';
|
||||
import type { YtmSong } from '../collector/ytmusic';
|
||||
@@ -63,6 +63,24 @@ export function mountQuizAdmin(app: Hono<Env>, d: QuizAdminDeps, h: { actor: (c:
|
||||
return c.json({ id });
|
||||
});
|
||||
|
||||
/** 파일로 만들기: a new quiz with the songs read from a file (the browser reads the file; values used as written). */
|
||||
app.post('/quizzes/file', async (c) => {
|
||||
const p = z.object({ name: z.string().trim().min(1).max(60), items: QuizSaveSchema.shape.items.min(1) }).safeParse(await h.body(c));
|
||||
if (!p.success) return c.json({ error: `만들 내용이 올바르지 않아요: ${p.error.issues.slice(0, 3).map((i) => i.path.join('.') || i.message).join(', ')}` }, 400);
|
||||
const limits = d.limits();
|
||||
if (limits.maxSongs && p.data.items.length > limits.maxSongs) return c.json({ error: `퀴즈 하나에는 곡을 ${limits.maxSongs}곡까지 넣을 수 있어요.` }, 400);
|
||||
const id = d.quizzes.create(h.actor(c), p.data.name, limits);
|
||||
if (typeof id === 'string') return c.json({ error: id }, 400);
|
||||
const items = p.data.items.map((it) => ({ ...it, id: undefined, songId: null, fromFile: true }));
|
||||
// songs with their own hints: hints come by vote unless the maker changes it in 설정
|
||||
const settings = { ...DEFAULT_QUIZ_SETTINGS, ...(items.some((it) => it.hints.length) ? { hint: 'manual' as const } : {}) };
|
||||
const saved = d.quizzes.save(id, { name: p.data.name, description: '', visibility: 'private', settings, items }, limits);
|
||||
if (typeof saved === 'string') return c.json({ error: saved }, 400);
|
||||
d.audit.log(h.actor(c), 'quiz.create', String(id), null, { name: p.data.name, songs: items.length, from: 'file' });
|
||||
d.onChange?.();
|
||||
return c.json({ id });
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- 검토 대기 (전체공개 퀴즈 → 서버 노래 DB)
|
||||
app.get('/reviews/count', (c) => {
|
||||
const levels = playStats(d.db, { sort: 'suggest', size: 1 }).suggestions;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Admin API (docs/02 관리자 페이지). Mounted under /api/admin. Ported from joke-app (rooms/games parts come later). */
|
||||
import { Hono, type Context } from 'hono';
|
||||
import { z } from 'zod';
|
||||
import { nicknameError, normalizeNickname, type Role } from '@mq/shared';
|
||||
import { nicknameError, normalizeNickname, parseVideoId, type Role } from '@mq/shared';
|
||||
import type { Audit, Roles } from '../admin/roles';
|
||||
import { SiteSettingsSchema, type SettingsStore } from '../admin/settings';
|
||||
import type { Sessions } from '../auth/sessions';
|
||||
@@ -48,20 +48,8 @@ export interface AdminDeps {
|
||||
type Env = { Variables: { userId: string | null; role: Role } };
|
||||
|
||||
const DISCORD_ID = /^\d{17,20}$/;
|
||||
const VIDEO_ID = /^[\w-]{11}$/;
|
||||
|
||||
/** Accepts https://youtu.be/ID, youtube.com/watch?v=ID, music.youtube.com/watch?v=ID or the bare ID. */
|
||||
export function parseVideoId(s: string): string | null {
|
||||
const t = s.trim();
|
||||
if (VIDEO_ID.test(t)) return t;
|
||||
try {
|
||||
const u = new URL(t);
|
||||
const id = u.hostname === 'youtu.be' ? u.pathname.slice(1) : u.searchParams.get('v');
|
||||
return id && VIDEO_ID.test(id) ? id : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/** Accepts the usual YouTube URL shapes or the bare ID (shared with the quiz file reader). */
|
||||
export { parseVideoId };
|
||||
|
||||
const SongPatchSchema = z.object({
|
||||
title: z.string().trim().min(1).max(200).optional(),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* 검토 대기 (전체공개 퀴즈 → 서버 노래 DB): after a 전체공개 quiz is saved, every song that is not in the DB, or whose
|
||||
* video / title / artist / 직접 정한 하이라이트 differs from its DB song, waits here. An admin picks, field by field, the DB
|
||||
* value or the quiz's; new songs get year/genres/level filled in and are added. Decided proposals are not asked again.
|
||||
* Songs that came from a quiz file (파일로 만들기) are used as written and never wait here.
|
||||
*/
|
||||
import type { Database } from 'bun:sqlite';
|
||||
import { createSong } from '../songs/admin-ops';
|
||||
@@ -42,7 +43,7 @@ export function syncReviews(db: Database, quizId: number, now = Date.now()): { p
|
||||
return { pending: 0 };
|
||||
}
|
||||
const items = db
|
||||
.query<ItemRow, [number]>('SELECT id, song_id, video_id, title, artist, title_answers, artist_answers, duration_sec, auto, highlight_sec FROM custom_quiz_items WHERE quiz_id = ?')
|
||||
.query<ItemRow, [number]>('SELECT id, song_id, video_id, title, artist, title_answers, artist_answers, duration_sec, auto, highlight_sec FROM custom_quiz_items WHERE quiz_id = ? AND from_file = 0')
|
||||
.all(quizId);
|
||||
const song = db.query<{ title: string; artist: string; youtube_id: string | null; youtube_status: string; highlight_sec: number | null }, [number]>(
|
||||
'SELECT title, artist, youtube_id, youtube_status, highlight_sec FROM songs WHERE id = ? AND deleted_at IS NULL',
|
||||
|
||||
@@ -26,6 +26,8 @@ interface ItemRow {
|
||||
artist: string;
|
||||
title_answers: string;
|
||||
artist_answers: string;
|
||||
hints: string;
|
||||
from_file: number;
|
||||
duration_sec: number | null;
|
||||
auto: number;
|
||||
start_sec: number | null;
|
||||
@@ -62,6 +64,8 @@ const item = (r: ItemRow): QuizItem => ({
|
||||
artist: r.artist,
|
||||
titleAnswers: JSON.parse(r.title_answers) as string[],
|
||||
artistAnswers: JSON.parse(r.artist_answers) as string[],
|
||||
hints: JSON.parse(r.hints) as string[],
|
||||
fromFile: !!r.from_file,
|
||||
durationSec: r.duration_sec,
|
||||
auto: !!r.auto,
|
||||
startSec: r.start_sec,
|
||||
@@ -112,7 +116,7 @@ export class CustomQuizzes {
|
||||
items(id: number): QuizItem[] {
|
||||
return this.db
|
||||
.query<ItemRow, [number]>(
|
||||
'SELECT id, song_id, video_id, title, artist, title_answers, artist_answers, duration_sec, auto, start_sec, highlight_sec FROM custom_quiz_items WHERE quiz_id = ? ORDER BY pos, id',
|
||||
'SELECT id, song_id, video_id, title, artist, title_answers, artist_answers, hints, from_file, duration_sec, auto, start_sec, highlight_sec FROM custom_quiz_items WHERE quiz_id = ? ORDER BY pos, id',
|
||||
)
|
||||
.all(id)
|
||||
.map(item);
|
||||
@@ -121,7 +125,7 @@ export class CustomQuizzes {
|
||||
item(quizId: number, itemId: number): QuizItem | null {
|
||||
const r = this.db
|
||||
.query<ItemRow, [number, number]>(
|
||||
'SELECT id, song_id, video_id, title, artist, title_answers, artist_answers, duration_sec, auto, start_sec, highlight_sec FROM custom_quiz_items WHERE quiz_id = ? AND id = ?',
|
||||
'SELECT id, song_id, video_id, title, artist, title_answers, artist_answers, hints, from_file, duration_sec, auto, start_sec, highlight_sec FROM custom_quiz_items WHERE quiz_id = ? AND id = ?',
|
||||
)
|
||||
.get(quizId, itemId);
|
||||
return r ? item(r) : null;
|
||||
@@ -142,11 +146,11 @@ export class CustomQuizzes {
|
||||
.run(data.name, data.description, data.visibility, JSON.stringify(data.settings), now, id);
|
||||
const keep = new Set<number>();
|
||||
const ins = this.db.query(
|
||||
`INSERT INTO custom_quiz_items (quiz_id, pos, song_id, video_id, title, artist, title_answers, artist_answers, duration_sec, auto, start_sec, highlight_sec)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
`INSERT INTO custom_quiz_items (quiz_id, pos, song_id, video_id, title, artist, title_answers, artist_answers, hints, from_file, duration_sec, auto, start_sec, highlight_sec)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
);
|
||||
const upd = this.db.query(
|
||||
`UPDATE custom_quiz_items SET pos = ?, song_id = ?, video_id = ?, title = ?, artist = ?, title_answers = ?, artist_answers = ?, duration_sec = ?, auto = ?,
|
||||
`UPDATE custom_quiz_items SET pos = ?, song_id = ?, video_id = ?, title = ?, artist = ?, title_answers = ?, artist_answers = ?, hints = ?, from_file = ?, duration_sec = ?, auto = ?,
|
||||
start_sec = ?, highlight_sec = ? WHERE id = ? AND quiz_id = ?`,
|
||||
);
|
||||
const alias = this.db.query("INSERT OR IGNORE INTO song_aliases (song_id, part, alias, source) VALUES (?, ?, ?, 'quiz')");
|
||||
@@ -161,6 +165,8 @@ export class CustomQuizzes {
|
||||
it.artist,
|
||||
JSON.stringify(titleAnswers),
|
||||
JSON.stringify(artistAnswers),
|
||||
JSON.stringify(it.hints ?? []),
|
||||
it.fromFile ? 1 : 0,
|
||||
it.durationSec,
|
||||
it.auto ? 1 : 0,
|
||||
it.auto ? null : it.startSec,
|
||||
|
||||
@@ -30,6 +30,8 @@ export interface QuizSong {
|
||||
/** Main artist ids (same singer not twice in a row, docs/05 출제 목록). */
|
||||
artistIds: number[];
|
||||
lyrics: string | null;
|
||||
/** 제작된 퀴즈: the song's own hints, shown one by one before the 초성 hint. */
|
||||
hints?: string[];
|
||||
}
|
||||
|
||||
export function quizSong(db: Database, id: number): QuizSong | null {
|
||||
@@ -73,9 +75,9 @@ export function quizSong(db: Database, id: number): QuizSong | null {
|
||||
export function quizItemSong(db: Database, quizId: number, itemId: number): QuizSong | null {
|
||||
const it = db
|
||||
.query<
|
||||
{ id: number; song_id: number | null; video_id: string; title: string; artist: string; title_answers: string; artist_answers: string; duration_sec: number | null; auto: number; start_sec: number | null; highlight_sec: number | null },
|
||||
{ id: number; song_id: number | null; video_id: string; title: string; artist: string; title_answers: string; artist_answers: string; hints: string; duration_sec: number | null; auto: number; start_sec: number | null; highlight_sec: number | null },
|
||||
[number, number]
|
||||
>('SELECT id, song_id, video_id, title, artist, title_answers, artist_answers, duration_sec, auto, start_sec, highlight_sec FROM custom_quiz_items WHERE quiz_id = ? AND id = ?')
|
||||
>('SELECT id, song_id, video_id, title, artist, title_answers, artist_answers, hints, duration_sec, auto, start_sec, highlight_sec FROM custom_quiz_items WHERE quiz_id = ? AND id = ?')
|
||||
.get(quizId, itemId);
|
||||
if (!it) return null;
|
||||
const base = it.song_id ? quizSong(db, it.song_id) : null;
|
||||
@@ -103,6 +105,7 @@ export function quizItemSong(db: Database, quizId: number, itemId: number): Quiz
|
||||
artistAliases: uniq([...(JSON.parse(it.artist_answers) as string[]), ...(base ? [base.artist, ...base.artistAliases] : [])]),
|
||||
artistIds: base?.artistIds ?? [],
|
||||
lyrics: base?.lyrics ?? null,
|
||||
hints: JSON.parse(it.hints) as string[],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user