Skip to content

Commit 579a67a

Browse files
committed
ensure consistent ordering when computing course indices
1 parent 6e40089 commit 579a67a

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

.sqlx/query-1c579f40cdef6c3d8673794c4f5f78add83bb41fdf73d4435d6ce5956287451b.json renamed to .sqlx/query-0f8c57e7eb8499a3f84190a9a44497f596c0be4c226e3c65fda4978907d82b5c.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cs2kz/src/maps/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,15 @@ pub async fn update(
375375
return Ok(true);
376376
}
377377

378-
let course_ids =
379-
sqlx::query_scalar!("SELECT id AS `id: CourseId` FROM Courses WHERE map_id = ?", id)
380-
.fetch(&mut *conn)
381-
.zip(futures_util::stream::iter(1..))
382-
.map(|(row, idx)| row.map(|row| (idx, row)))
383-
.try_collect::<HashMap<_, _>>()
384-
.await?;
378+
let course_ids = sqlx::query_scalar!(
379+
"SELECT id AS `id: CourseId` FROM Courses WHERE map_id = ? ORDER BY id ASC",
380+
id
381+
)
382+
.fetch(&mut *conn)
383+
.zip(futures_util::stream::iter(1..))
384+
.map(|(row, idx)| row.map(|row| (idx, row)))
385+
.try_collect::<HashMap<_, _>>()
386+
.await?;
385387

386388
for course_update in course_updates {
387389
let course_id = course_ids

0 commit comments

Comments
 (0)