전체일정 스코어 조정, utc 시간 -> kst 변경
This commit is contained in:
1 parent
7185cfbb72
commit
8a4a23b0cb
9 files changed
+71
-35
No files matched your search
@@ -7,7 +7,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import selectinload
|
||||
|
||||
from ..database import get_db
|
||||
from ..domain import crowd_out, is_open_for_voting
|
||||
from ..domain import compute_phase, crowd_out, is_open_for_voting
|
||||
from ..models import AIPrediction, CrowdStats, Match, UserPrediction
|
||||
from ..scoring import outcome_of
|
||||
from ..schemas import SubmitPredictionIn, SubmitPredictionOut
|
||||
@@ -50,10 +50,16 @@ async def submit_prediction(
|
||||
if not match:
|
||||
raise HTTPException(status_code=404, detail="MATCH_NOT_FOUND")
|
||||
if not is_open_for_voting(match):
|
||||
# 마감/종료/오픈전 구분
|
||||
if match.result_outcome is not None:
|
||||
raise HTTPException(status_code=409, detail="MATCH_FINISHED")
|
||||
raise HTTPException(status_code=423, detail="MATCH_LOCKED")
|
||||
# 종료 사유 정밀 구분: 종료 / 경기중 / 투표종료 / 오픈전
|
||||
phase = compute_phase(match)
|
||||
detail = {
|
||||
"finished": "MATCH_FINISHED", # 결과 입력됨
|
||||
"live": "MATCH_LIVE", # 경기중
|
||||
"locked": "MATCH_LOCKED", # 투표 종료(킥오프 1h 전)
|
||||
"scheduled": "MATCH_NOT_OPEN", # 아직 오픈 전
|
||||
}.get(phase, "MATCH_LOCKED")
|
||||
code = 409 if phase == "finished" else 423
|
||||
raise HTTPException(status_code=code, detail=detail)
|
||||
|
||||
# outcome 은 스코어에서 도출 (입력과 불일치해도 스코어 기준으로 정규화)
|
||||
outcome = outcome_of(body.scoreA, body.scoreB)
|
||||
|
||||
Reference in new issue
Block a user