fix missing game_files generation
This commit is contained in:
5
app.py
5
app.py
@ -8,6 +8,7 @@ from dto.requests import GameStartRequestDTO, GameDecisionRequestDTO
|
||||
from dto.responses import GameStartResponseWithBotDecisionDTO, GameDecisionResponseWithBotDecisionDTO
|
||||
from services.julius_baer_api_client import JuliusBaerApiClient
|
||||
from services.advisor import Advisor
|
||||
from utils.storage.game_files_manager import store_game_round_data
|
||||
|
||||
app = Flask(__name__)
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - [%(module)s] - %(message)s')
|
||||
@ -32,6 +33,8 @@ def new_game():
|
||||
bot_reason=bot_decision.reason,
|
||||
)
|
||||
|
||||
store_game_round_data(bot_decision.answer, res_with_bot_decision, res.score, str(res.session_id), 'active')
|
||||
|
||||
return res_with_bot_decision.model_dump_json()
|
||||
|
||||
|
||||
@ -57,6 +60,8 @@ def next_client():
|
||||
bot_reason=bot_decision.reason,
|
||||
)
|
||||
|
||||
store_game_round_data(bot_decision.answer, res_with_bot_decision, res.score, str(session_id), res.status)
|
||||
|
||||
return res_with_bot_decision.model_dump_json()
|
||||
|
||||
|
||||
|
@ -6,13 +6,17 @@ import json
|
||||
from typing import Dict, Any
|
||||
from pathlib import Path
|
||||
|
||||
from dto.responses import GameStartResponseDTO, GameDecisionResponseDTO
|
||||
from dto.responses import GameStartResponseWithBotDecisionDTO, GameDecisionResponseWithBotDecisionDTO
|
||||
|
||||
GAME_FILES_DIR = config.GAME_FILES_DIR
|
||||
|
||||
# Define padding for round numbers (e.g., 6 digits for up to 999,999 rounds)
|
||||
FOLDER_ROUND_PADDING = 6
|
||||
|
||||
############################
|
||||
# WARNING - Technical Debt #
|
||||
############################
|
||||
|
||||
|
||||
def _get_previous_round_folder(current_round: int, session_id: str) -> str | None:
|
||||
"""
|
||||
@ -83,7 +87,7 @@ def store_decoded_files(response: Dict[str, Any] | None, directory: str):
|
||||
logging.error(f"[!] Unexpected error saving file '{key}{extension}' in {directory}: {e}")
|
||||
|
||||
|
||||
def store_game_round_data(decision: str, response: GameStartResponseDTO | GameDecisionResponseDTO, round_number: int,
|
||||
def store_game_round_data(decision: str, response: GameStartResponseWithBotDecisionDTO | GameDecisionResponseWithBotDecisionDTO, round_number: int,
|
||||
session_id: str, status: str):
|
||||
"""
|
||||
Logs structured response data and saves associated client files.
|
||||
|
Reference in New Issue
Block a user