refactor(gameplay): extract round question payload builder
This commit is contained in:
@@ -13,6 +13,19 @@ def build_player_ref(player: Player | None) -> dict | None:
|
||||
}
|
||||
|
||||
|
||||
def build_round_question_payload(round_question: RoundQuestion | None) -> dict | None:
|
||||
if round_question is None:
|
||||
return None
|
||||
|
||||
return {
|
||||
"id": round_question.id,
|
||||
"round_number": round_question.round_number,
|
||||
"prompt": round_question.question.prompt,
|
||||
"shown_at": round_question.shown_at.isoformat(),
|
||||
"answers": [{"text": text} for text in (round_question.mixed_answers or [])],
|
||||
}
|
||||
|
||||
|
||||
def build_reveal_payload(round_question: RoundQuestion | None) -> dict | None:
|
||||
if round_question is None:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user