tauri-app: fix end-of-game stats reading, pass raw json file to front
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m6s
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m6s
This commit is contained in:
@@ -53,9 +53,9 @@ function closeDetail() {
|
||||
function getLocalPlayer(stats: RawEndGameStats | null): EndGamePlayer | null {
|
||||
if (!stats) return null;
|
||||
|
||||
// Try local_player field first
|
||||
if (stats.local_player) {
|
||||
return stats.local_player;
|
||||
// Try localPlayer field first (camelCase from API)
|
||||
if (stats.localPlayer) {
|
||||
return stats.localPlayer;
|
||||
}
|
||||
|
||||
// Try teams
|
||||
@@ -63,7 +63,7 @@ function getLocalPlayer(stats: RawEndGameStats | null): EndGamePlayer | null {
|
||||
for (const team of stats.teams) {
|
||||
if (team.players) {
|
||||
for (const player of team.players) {
|
||||
if (player.is_local_player) {
|
||||
if (player.isLocalPlayer) {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,30 +180,32 @@ export interface Timeline {
|
||||
/**
|
||||
* Raw end-of-game stats from the League Client API.
|
||||
* This is the full response from the end-of-game stats endpoint.
|
||||
* Note: Properties use camelCase to match the actual API response.
|
||||
*/
|
||||
export interface RawEndGameStats {
|
||||
/** Game ID. */
|
||||
game_id?: number;
|
||||
gameId?: number;
|
||||
/** Game length in seconds. */
|
||||
game_length?: number;
|
||||
gameLength?: number;
|
||||
/** Match ID. */
|
||||
match_id?: number;
|
||||
matchId?: number | null;
|
||||
/** Game result. */
|
||||
game_result?: string;
|
||||
gameResult?: string | null;
|
||||
/** Local player data. */
|
||||
local_player?: EndGamePlayer;
|
||||
localPlayer?: EndGamePlayer;
|
||||
/** Teams data. */
|
||||
teams?: EndGameTeam[];
|
||||
/** Players (legacy format). */
|
||||
players?: EndGamePlayer[];
|
||||
players?: EndGamePlayer[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Player in end-of-game stats.
|
||||
* Note: Properties use camelCase to match the actual API response.
|
||||
*/
|
||||
export interface EndGamePlayer {
|
||||
/** Whether this is the local player. */
|
||||
is_local_player?: boolean;
|
||||
isLocalPlayer?: boolean;
|
||||
/** Player stats. */
|
||||
stats?: PlayerStats;
|
||||
/** Items (array of item IDs). */
|
||||
@@ -212,12 +214,13 @@ export interface EndGamePlayer {
|
||||
|
||||
/**
|
||||
* Team in end-of-game stats.
|
||||
* Note: Properties use camelCase to match the actual API response.
|
||||
*/
|
||||
export interface EndGameTeam {
|
||||
/** Whether this is the player's team. */
|
||||
is_player_team?: boolean;
|
||||
isPlayerTeam?: boolean;
|
||||
/** Whether this is the winning team. */
|
||||
is_winning_team?: boolean;
|
||||
isWinningTeam?: boolean;
|
||||
/** Players on the team. */
|
||||
players?: EndGamePlayer[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user