replace items record with full end-of-game stats record
record-daemon / Build, check and test (push) Successful in 2m5s
record-daemon / Build, check and test (push) Successful in 2m5s
- record-daemon: remove items parsing module - tauri-app: add items parsing from recorded end-of-game stats
This commit is contained in:
@@ -503,10 +503,6 @@ impl Daemon {
|
||||
StateTransition::GameEnded => {
|
||||
info!("[EVENT_HANDLER] GameEnded transition");
|
||||
|
||||
// Fetch final items before stopping
|
||||
let fetched_final_items =
|
||||
self.lqp_client.fetch_final_items().await.ok().flatten();
|
||||
|
||||
// Fetch end-of-game stats from API
|
||||
let game_end_stats = self.lqp_client.fetch_game_end_stats().await.ok();
|
||||
|
||||
@@ -515,10 +511,7 @@ impl Daemon {
|
||||
game_end_stats
|
||||
);
|
||||
|
||||
if let Err(e) = self
|
||||
.stop_recording_with_metadata(game_end_stats, fetched_final_items)
|
||||
.await
|
||||
{
|
||||
if let Err(e) = self.stop_recording_with_metadata(game_end_stats).await {
|
||||
error!("[EVENT_HANDLER] Failed to stop recording: {}", e);
|
||||
|
||||
// Don't propagate error - keep daemon running
|
||||
@@ -608,14 +601,13 @@ impl Daemon {
|
||||
|
||||
/// Stop recording.
|
||||
async fn stop_recording(&self) -> Result<()> {
|
||||
self.stop_recording_with_metadata(None, None).await
|
||||
self.stop_recording_with_metadata(None).await
|
||||
}
|
||||
|
||||
/// Stop recording with optional game end stats.
|
||||
async fn stop_recording_with_metadata(
|
||||
&self,
|
||||
game_end_stats: Option<record_daemon::lqp::EndOfGameStatsResponse>,
|
||||
final_items: Option<record_daemon::lqp::ItemBuild>,
|
||||
) -> Result<()> {
|
||||
info!("Stopping recording");
|
||||
|
||||
@@ -672,6 +664,9 @@ impl Daemon {
|
||||
update.victory = Some(stats.is_victory());
|
||||
update.match_id = stats.match_id.map(|id| id.to_string());
|
||||
|
||||
// Store raw end-of-game stats as JSON
|
||||
update.raw_end_game_stats = serde_json::to_value(&stats).ok();
|
||||
|
||||
// Get local player stats
|
||||
if let Some(player) = stats.get_local_player() {
|
||||
if let Some(player_stats) = &player.stats {
|
||||
@@ -692,9 +687,6 @@ impl Daemon {
|
||||
}
|
||||
}
|
||||
|
||||
// Add final items
|
||||
update.final_items = final_items;
|
||||
|
||||
// Apply the update
|
||||
if let Err(e) = timeline_store.write().update_metadata(recording_id, update) {
|
||||
warn!("Failed to update recording metadata: {}", e);
|
||||
|
||||
Reference in New Issue
Block a user