record-daemon: fix summoner spells handling
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m22s
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m22s
This commit is contained in:
@@ -403,14 +403,26 @@ impl Daemon {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// If we have puuid and session, extract player-specific data from session
|
// If we have puuid and session, extract player-specific data from session
|
||||||
let (champion, final_team, final_summoner_name) = if let Some(ref p) = puuid
|
let (champion, final_team, final_summoner_name, final_summoner_spells) =
|
||||||
{
|
if let Some(ref p) = puuid {
|
||||||
if let Some(ref sess) = session {
|
if let Some(ref sess) = session {
|
||||||
let champ_id = sess.get_champion_id(p);
|
let champ_id = sess.get_champion_id(p);
|
||||||
let champ_name =
|
let champ_name =
|
||||||
champ_id.and_then(record_daemon::lqp::champion_id_to_name);
|
champ_id.and_then(record_daemon::lqp::champion_id_to_name);
|
||||||
let team_id = sess.get_team(p);
|
let team_id = sess.get_team(p);
|
||||||
let summoner = sess.get_summoner_name(p).map(|s| s.to_string());
|
let summoner = sess.get_summoner_name(p).map(|s| s.to_string());
|
||||||
|
|
||||||
|
// Extract summoner spells from session's player_champion_selections
|
||||||
|
let spells_from_session =
|
||||||
|
sess.get_player_selection(p).map(|selection| {
|
||||||
|
record_daemon::lqp::SummonerSpells {
|
||||||
|
spell1_id: selection.spell1_id,
|
||||||
|
spell2_id: selection.spell2_id,
|
||||||
|
spell1_name: None,
|
||||||
|
spell2_name: None,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
(
|
(
|
||||||
champ_name.or_else(|| {
|
champ_name.or_else(|| {
|
||||||
champion_id
|
champion_id
|
||||||
@@ -418,12 +430,15 @@ impl Daemon {
|
|||||||
}),
|
}),
|
||||||
team_id.or(team),
|
team_id.or(team),
|
||||||
summoner.or(summoner_name),
|
summoner.or(summoner_name),
|
||||||
|
spells_from_session.or(summoner_spells),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(
|
(
|
||||||
champion_id.and_then(record_daemon::lqp::champion_id_to_name),
|
champion_id
|
||||||
|
.and_then(record_daemon::lqp::champion_id_to_name),
|
||||||
team,
|
team,
|
||||||
summoner_name,
|
summoner_name,
|
||||||
|
summoner_spells,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -431,12 +446,13 @@ impl Daemon {
|
|||||||
champion_id.and_then(record_daemon::lqp::champion_id_to_name),
|
champion_id.and_then(record_daemon::lqp::champion_id_to_name),
|
||||||
team,
|
team,
|
||||||
summoner_name,
|
summoner_name,
|
||||||
|
summoner_spells,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"[EVENT_HANDLER] Final values: puuid={:?}, runes={:?}, summoner_spells={:?}",
|
"[EVENT_HANDLER] Final values: puuid={:?}, runes={:?}, summoner_spells={:?}",
|
||||||
puuid, runes, summoner_spells
|
puuid, runes, final_summoner_spells
|
||||||
);
|
);
|
||||||
|
|
||||||
// Fetch all players identities for puuid mapping
|
// Fetch all players identities for puuid mapping
|
||||||
@@ -464,7 +480,7 @@ impl Daemon {
|
|||||||
summoner_name: final_summoner_name,
|
summoner_name: final_summoner_name,
|
||||||
puuid,
|
puuid,
|
||||||
runes,
|
runes,
|
||||||
summoner_spells,
|
summoner_spells: final_summoner_spells,
|
||||||
all_players: all_players_info,
|
all_players: all_players_info,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user