feat: Ensure consistent ordering of games, users, and user opinions, and add DerefMut for User.
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user