Skip to content

Commit d5eeb40

Browse files
committed
fix: sort questions by id before upload
1 parent 3df69ec commit d5eeb40

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

services/updater/src/update_storage.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ export const updateStorage = async (
4848
if (seasonQuestions === null) {
4949
return;
5050
}
51-
const updatedSeasonQuestions = mergeByKey("id", updates, seasonQuestions);
51+
const updatedSeasonQuestions = mergeByKey("id", updates, seasonQuestions)
52+
.toSorted((a, b) => Number.parseInt(b.id) - Number.parseInt(a.id));
5253
await update(
5354
logger,
5455
updatedSeasonQuestions,
@@ -59,7 +60,8 @@ export const updateStorage = async (
5960
if (questions === null) {
6061
return;
6162
}
62-
const updatedQuestions = mergeByKey("id", updatedSeasonQuestions, questions);
63+
const updatedQuestions = mergeByKey("id", updatedSeasonQuestions, questions)
64+
.toSorted((a, b) => Number.parseInt(b.id) - Number.parseInt(a.id));
6365
await update(
6466
logger,
6567
updatedQuestions,

0 commit comments

Comments
 (0)