Skip to content

Commit 444b9c2

Browse files
authored
fix: ensure full top200 for rank pp calc (MaxOhn#1065)
1 parent 7586bb5 commit 444b9c2

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

  • bathbot/src/commands/osu/rank

bathbot/src/commands/osu/rank/pp.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ impl RankData {
805805

806806
let pb_fmt = PersonalBestIndexFormatter::new(pb_start_idx, amount);
807807

808-
if scores.len() >= 100 && required < *pps.last().unwrap() {
808+
if scores.len() == 200 && required < *pps.last().unwrap() {
809809
required = (*pps.last().unwrap() - 0.01).max(0.0);
810810
}
811811

@@ -834,6 +834,12 @@ impl RankData {
834834

835835
let mut pps = scores.extract_pp();
836836

837+
// Top10k players most definitely have a full top200 but let's
838+
// ensure it regardless
839+
if pps.len() < 200 {
840+
pps.extend(iter::repeat_n(0.0, 200 - pps.len()));
841+
}
842+
837843
let (required, idx) = pp_missing(user_pp, rank_holder_pp, scores);
838844
let required = required as f32;
839845

@@ -997,7 +1003,7 @@ impl RankData {
9971003

9981004
let pb_fmt = PersonalBestIndexFormatter::new(pb_start_idx, amount);
9991005

1000-
if scores.len() >= 100 && required < *pps.last().unwrap() {
1006+
if scores.len() == 200 && required < *pps.last().unwrap() {
10011007
required = (*pps.last().unwrap() - 0.01).max(0.0);
10021008
}
10031009

@@ -1030,6 +1036,11 @@ impl RankData {
10301036

10311037
let mut pps = scores.extract_pp();
10321038

1039+
// Make sure there's a full top200 to work with
1040+
if pps.len() < 200 {
1041+
pps.extend(iter::repeat_n(0.0, 200 - pps.len()));
1042+
}
1043+
10331044
let (required, idx) = pp_missing(user_pp, required_pp, scores);
10341045
let required = required as f32;
10351046

0 commit comments

Comments
 (0)