Don't assume user_best scores have pp

This commit is contained in:
Natsu Kagami 2024-03-17 17:09:58 +01:00
parent 13683aa229
commit 94dc225b86
Signed by: nki
GPG key ID: 55A032EB38B49ADB

View file

@ -612,7 +612,11 @@ pub async fn check(ctx: &Context, msg: &Message, mut args: Args) -> CommandResul
.into_iter() .into_iter()
.filter(|s| s.mods.contains(mods)) .filter(|s| s.mods.contains(mods))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
scores.sort_by(|a, b| b.pp.unwrap().partial_cmp(&a.pp.unwrap()).unwrap()); scores.sort_by(|a, b| {
b.pp.unwrap_or(-1.0)
.partial_cmp(&a.pp.unwrap_or(-1.0))
.unwrap()
});
if scores.is_empty() { if scores.is_empty() {
msg.reply(&ctx, "No scores found").await?; msg.reply(&ctx, "No scores found").await?;