osu: Try to find the right score when announcing

This commit is contained in:
Natsu Kagami 2024-06-16 22:33:24 +02:00
parent aa90422c99
commit dc44a0b4b3
Signed by: nki
GPG key ID: 55A032EB38B49ADB

View file

@ -252,7 +252,10 @@ impl<'a> CollectedScore<'a> {
f.user(UserID::ID(user.id)).mode(event.mode)
})
.await?;
let score = match scores.into_iter().next() {
let score = match scores
.into_iter()
.find(|s| (s.date - event.date).abs() < chrono::TimeDelta::seconds(5))
{
Some(v) => v,
None => return Err(Error::msg("cannot get score for map...")),
};