refactor(gameplay): extract round start payload builders
This commit is contained in:
@@ -134,7 +134,7 @@ def build_phase_view_model(session: GameSession, *, players_count: int, has_roun
|
||||
}
|
||||
|
||||
|
||||
def build_start_next_round_response(
|
||||
def build_start_round_response(
|
||||
session: GameSession,
|
||||
round_config: RoundConfig,
|
||||
round_question: RoundQuestion,
|
||||
@@ -166,6 +166,39 @@ def build_start_next_round_response(
|
||||
}
|
||||
|
||||
|
||||
def build_question_shown_payload(round_question: RoundQuestion, lie_deadline_at: str, lie_seconds: int) -> dict:
|
||||
return {
|
||||
"round_question_id": round_question.id,
|
||||
"prompt": round_question.question.prompt,
|
||||
"shown_at": round_question.shown_at.isoformat(),
|
||||
"lie_deadline_at": lie_deadline_at,
|
||||
"lie_seconds": lie_seconds,
|
||||
}
|
||||
|
||||
|
||||
def build_question_shown_response(round_question: RoundQuestion, lie_deadline_at: str, lie_seconds: int) -> dict:
|
||||
return {
|
||||
"round_question": {
|
||||
"id": round_question.id,
|
||||
"prompt": round_question.question.prompt,
|
||||
"round_number": round_question.round_number,
|
||||
"shown_at": round_question.shown_at.isoformat(),
|
||||
"lie_deadline_at": lie_deadline_at,
|
||||
},
|
||||
"config": {
|
||||
"lie_seconds": lie_seconds,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def build_start_next_round_response(
|
||||
session: GameSession,
|
||||
round_config: RoundConfig,
|
||||
round_question: RoundQuestion,
|
||||
) -> dict:
|
||||
return build_start_round_response(session, round_config, round_question)
|
||||
|
||||
|
||||
def build_start_next_round_phase_event(
|
||||
session: GameSession,
|
||||
round_config: RoundConfig,
|
||||
|
||||
Reference in New Issue
Block a user