mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-18 16:28:55 +00:00
Sort beatmaps by a preliminary order
This commit is contained in:
parent
bd845d9662
commit
99d59b3548
1 changed files with 2 additions and 1 deletions
|
@ -79,13 +79,14 @@ impl BeatmapMetaCache {
|
|||
.await
|
||||
}
|
||||
None => {
|
||||
let beatmaps = self
|
||||
let mut beatmaps = self
|
||||
.client
|
||||
.beatmaps(crate::BeatmapRequestKind::Beatmapset(id), |f| f)
|
||||
.await?;
|
||||
if beatmaps.is_empty() {
|
||||
return Err(Error::msg("beatmapset not found"));
|
||||
}
|
||||
beatmaps.sort_by_key(|b| (b.mode as u8, (b.difficulty.stars * 1000.0) as u64)); // Cast so that Ord is maintained
|
||||
if let ApprovalStatus::Ranked(_) = &beatmaps[0].approval {
|
||||
// Save each beatmap.
|
||||
beatmaps.iter().for_each(|b| {
|
||||
|
|
Loading…
Add table
Reference in a new issue