Skip to content

Commit e07683d

Browse files
author
zuscher
committed
Store display_rating in PlayerEvent
1 parent 82c2a1c commit e07683d

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

multi-skill/src/summary.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ pub fn make_leaderboard(
5353
let max_rating = player
5454
.event_history
5555
.iter()
56-
.map(PlayerEvent::get_display_rating)
56+
.map(|event| event.display_rating)
5757
.max()
5858
.unwrap();
59-
let display_rating = last_event.get_display_rating();
59+
let display_rating = last_event.display_rating;
6060
let prev_rating = if num_contests == 1 {
6161
0
6262
} else {
63-
player.event_history[num_contests - 2].get_display_rating()
63+
player.event_history[num_contests - 2].display_rating
6464
};
6565
rating_data.push(PlayerSummary {
6666
rank: None,

multi-skill/src/systems/common/player.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub struct PlayerEvent {
99
pub rating_sig: i32,
1010
pub perf_score: i32,
1111
pub place: usize,
12+
pub display_rating: i32,
1213
}
1314

1415
impl PlayerEvent {
@@ -65,6 +66,8 @@ impl Player {
6566
last_event.rating_mu = rating.mu.round() as i32;
6667
last_event.rating_sig = rating.sig.round() as i32;
6768
last_event.perf_score = performance_score.round() as i32;
69+
70+
last_event.display_rating = last_event.get_display_rating();
6871
}
6972

7073
pub fn update_rating_with_normal(&mut self, performance: Rating) {

worldrank-api/src/domain/history.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct HistoryPoint {
1515
impl HistoryPoint {
1616
pub fn new(event: &PlayerEvent, contest: &ContestSummary) -> Self {
1717
Self {
18-
display_rating: event.get_display_rating(),
18+
display_rating: event.display_rating,
1919
perf_score: event.perf_score,
2020
place: event.place,
2121
num_contestants: contest.num_contestants,

0 commit comments

Comments
 (0)