Improve genre parsing

Fix game list sorting
This commit is contained in:
2025-12-14 22:42:31 +08:00
parent 12e8bd2b92
commit 111de9a8b0
4 changed files with 52 additions and 38 deletions

View File

@@ -39,7 +39,20 @@ enum Status {
impl MainView {
pub fn new(mut db_factory: RocksDBFactory) -> color_eyre::Result<Self> {
let db = db_factory.get_current_context()?;
let games = db.get_all_values::<DLSiteManiax>()?;
let mut games = db.get_all_values::<DLSiteManiax>()?;
games.sort_by(|a, b| {
let left = a.rj_num
.chars().skip(2)
.collect::<String>()
.parse::<u32>()
.unwrap();
let right = b.rj_num
.chars().skip(2)
.collect::<String>()
.parse::<u32>()
.unwrap();
left.cmp(&right)
});
let dl_game_list = GameList::new(games)?;
let view = Self {
state: MainViewState {