Update: [main] 디스코드 알림 개선 - footer 제거 및 워크북 진행도 표시
All checks were successful
baekjoon-bot-cicd / build_push_deploy (push) Successful in 5m40s

워크북 모드에서 (k/n) 진행도를 타이틀에 표시하고, 양쪽 모드 모두 하단 정기 알림 footer 제거

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
sm4640
2026-03-30 15:32:17 +09:00
parent 0076eefda2
commit 76f604a094
2 changed files with 17 additions and 8 deletions

View File

@@ -7,7 +7,7 @@ async def pick_from_workbook(
db: AsyncSession,
workbook_id: int,
pick: str = "random", # random | level_asc
) -> Tuple[Optional[int], Optional[str], Optional[int]]:
) -> Tuple[Optional[int], Optional[str], Optional[int], Optional[int], Optional[int]]:
"""
workbook_id에서 아직 보내지 않은 문제 1개 선택 + workbook_sends 기록까지 원샷.
pick:
@@ -46,17 +46,27 @@ async def pick_from_workbook(
FROM candidate
ON CONFLICT DO NOTHING
RETURNING problem_id
),
total AS (
SELECT COUNT(*) AS cnt FROM workbook_problems WHERE workbook_id = :wid
),
sent AS (
SELECT COUNT(*) AS cnt FROM workbook_sends WHERE workbook_id = :wid
)
SELECT problem_id, title, level
SELECT candidate.problem_id, candidate.title, candidate.level,
(SELECT cnt FROM sent) + 1 AS current_idx,
(SELECT cnt FROM total) AS total_cnt
FROM candidate;
"""
row = (await db.execute(text(sql), {"wid": workbook_id})).first()
if not row:
return None, None, None
return None, None, None, None, None
await db.commit()
pid = int(row[0])
title = str(row[1])
level = int(row[2]) if row[2] is not None else None
return pid, title, level
current_idx = int(row[3])
total_cnt = int(row[4])
return pid, title, level, current_idx, total_cnt