feat: Ensure consistent ordering of games, users, and user opinions, and add DerefMut for User.

This commit is contained in:
2025-12-05 00:33:07 +01:00
parent f312da33b5
commit 0a526c0c57
2 changed files with 23 additions and 4 deletions
+6
View File
@@ -75,6 +75,8 @@ async fn add_game(
games.push(game.clone());
games.sort_unstable_by(|g1, g2| g1.title.cmp(&g2.title));
let users = user_list.lock().await;
save_state(&games, &users);
@@ -113,6 +115,10 @@ async fn add_opinion(
existing.would_play = req.would_play;
} else {
user.person.opinion.push(opinion);
user.person
.opinion
.sort_unstable_by(|o1, o2| o1.title.cmp(&o2.title));
}
result = Some(user.person.clone());
}