Réglage des problèmes de tri du score (#5)
Rust Checks / checks (push) Successful in 18s Details

Reviewed-on: #5
Reviewed-by: Corentin <solois.corentin@gmail.com>
Co-authored-by: Tipragot <contact@tipragot.fr>
Co-committed-by: Tipragot <contact@tipragot.fr>
This commit is contained in:
Tipragot 2024-01-10 13:59:29 +00:00 committed by Corentin
parent e10427d0ac
commit 0fae1f39d4
1 changed files with 4 additions and 2 deletions

View File

@ -139,7 +139,8 @@ async fn get_scores(Query(params): Query<ScoresParams>) -> impl IntoResponse {
SortedBy::Time => {
for i in 0..count as usize {
if score.time > scores[i].time {
*scores.get_mut(i).expect("failed to get score (impossible)") = response;
scores.insert(i, response);
scores.remove(count as usize);
break;
}
}
@ -147,7 +148,8 @@ async fn get_scores(Query(params): Query<ScoresParams>) -> impl IntoResponse {
SortedBy::Score => {
for i in 0..count as usize {
if score.score > scores[i].score {
*scores.get_mut(i).expect("failed to get score (impossible)") = response;
scores.insert(i, response);
scores.remove(count as usize);
break;
}
}