fix: Refactored how quality profiles, language profiles, and metadata profiles are populated for each servarr so they sort using the ID to mimic the web UI better

This commit is contained in:
2026-01-08 10:05:15 -07:00
parent 1a43d1ec7c
commit ca208ff5e4
6 changed files with 58 additions and 37 deletions
+15 -8
View File
@@ -11,6 +11,7 @@ use crate::models::{
use crate::network::lidarr_network::LidarrEvent;
use bimap::BiMap;
use chrono::{DateTime, Utc};
use itertools::Itertools;
use strum::EnumIter;
#[cfg(test)]
use {
@@ -68,17 +69,23 @@ impl LidarrData<'_> {
}
pub fn sorted_quality_profile_names(&self) -> Vec<String> {
let mut quality_profile_names: Vec<String> =
self.quality_profile_map.right_values().cloned().collect();
quality_profile_names.sort();
quality_profile_names
self
.quality_profile_map
.iter()
.sorted_by_key(|(id, _)| *id)
.map(|(_, name)| name)
.cloned()
.collect()
}
pub fn sorted_metadata_profile_names(&self) -> Vec<String> {
let mut metadata_profile_names: Vec<String> =
self.metadata_profile_map.right_values().cloned().collect();
metadata_profile_names.sort();
metadata_profile_names
self
.metadata_profile_map
.iter()
.sorted_by_key(|(id, _)| *id)
.map(|(_, name)| name)
.cloned()
.collect()
}
}