이지선다 조회수 자동: 빈 양식에서 조회수 열을 빼고, 올린 뒤 서버가 곡마다 토픽 음원 + MV 조회수를 불러와 더함. 짝은 유튜브 뮤직 노래↔동영상 전환(watch 응답의 counterpart, 쿠키 필요), 조회수는 로그인 없이 player videoDetails.viewCount(안 되면 watch 화면 숫자). quizzes/duel-views.ts가 pending 곡을 한 곡씩 처리(재시작해도 이어서), 쿠키 만료면 남은 곡 모두 이유와 함께 failed. 짝이 없는 곡은 있는 영상 하나만 쓰고 비고 표시. 파일·편집기에 적은 숫자는 그대로 쓰고 다시 불러오기에서 빠짐, 칸을 비우고 저장하면 자동. 편집기: 조회수(토픽·MV)·비고 칸, 불러오는 중 표시와 2초 폴링(저장 안 됨으로 안 잡힘), 조회수 다시 불러오기(전체/곡), 저장 때 편집기의 옛 사본이 서버가 불러온 값을 덮지 않음. 내보내기는 직접 넣은 숫자만 조회수 열에. 파일로 만들기는 조회수 열이 없으면 고른 종류 유지. 014 마이그레이션, 단위·API 테스트, e2e duel 단계, docs 04·10·12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-03 21:07:10 +09:00
parent c55702d440
commit aacc4133b5
20 changed files with 784 additions and 72 deletions

View File

@@ -49,8 +49,40 @@ export interface QuizItem {
auto: boolean;
startSec: number | null;
highlightSec: number | null;
/** 이지선다 퀴즈: the video's view count as written in the file (null = not given; such songs are left out of games). */
/**
* 이지선다 퀴즈: the view count the game compares (null = none yet; such songs are left out of games).
* Written by hand / in the file (viewsAuto null) or the server's 토픽 + MV sum (viewsAuto).
*/
views: number | null;
/** 이지선다 퀴즈: views the server fetched (토픽 음원 + its MV, paired by YouTube Music); null = written by hand / in the file. */
viewsAuto: DuelViews | null;
}
/** 조회수 자동: the 토픽 (art track) and MV of one song, paired by YouTube Music's 노래 ↔ 동영상 switch. */
export interface DuelViews {
/** pending: waiting for the server · done: views = topicViews + mvViews · failed: see error (views stays as it was). */
state: 'pending' | 'done' | 'failed';
topicId: string | null;
topicViews: number | null;
/** The music video, or the linked video itself when it is not a 토픽 and has no 토픽 pair. */
mvId: string | null;
mvViews: number | null;
error: string | null;
/** When it was last fetched. */
at: number | null;
}
export const PENDING_VIEWS: DuelViews = { state: 'pending', topicId: null, topicViews: null, mvId: null, mvViews: null, error: null, at: null };
/** 비고 of an 이지선다 song: where its views come from when that is not the usual 토픽 + MV. */
export function duelViewsNote(it: Pick<QuizItem, 'views' | 'viewsAuto' | 'fromFile'>): string | null {
const a = it.viewsAuto;
if (!a) return it.views === null ? null : it.fromFile ? '파일에 적힌 조회수' : '직접 넣은 조회수';
if (a.state === 'failed') return a.error;
if (a.state !== 'done') return null;
if (!a.topicId) return '토픽 없음 (MV 조회수만)';
if (!a.mvId) return 'MV 없음 (토픽 조회수만)';
return null;
}
export interface QuizSummary {