From 3a0d1c0432484af3607a84f9b1053f55109e7e47 Mon Sep 17 00:00:00 2001 From: Battlesquid <25509915+Battlesquid@users.noreply.github.com> Date: Fri, 19 Jun 2026 19:44:10 -0700 Subject: [PATCH 1/2] fix: fix storage update not working properly --- packages/utils/src/arrays.ts | 8 ++++---- services/updater/src/update_storage.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/utils/src/arrays.ts b/packages/utils/src/arrays.ts index d4fb586..5692ecf 100644 --- a/packages/utils/src/arrays.ts +++ b/packages/utils/src/arrays.ts @@ -36,14 +36,14 @@ export const mergeByKey = < B extends Record, >( key: K, - a: A[], - b: B[], + current: A[], + updated: B[], ): (A | B | (A & B))[] => { const map = new Map(); - for (const item of a) { + for (const item of current) { map.set(item[key], item); } - for (const item of b) { + for (const item of updated) { const existing = map.get(item[key]); map.set(item[key], existing ? { ...existing, ...item } : item); } diff --git a/services/updater/src/update_storage.ts b/services/updater/src/update_storage.ts index 5360848..296a08c 100644 --- a/services/updater/src/update_storage.ts +++ b/services/updater/src/update_storage.ts @@ -43,7 +43,7 @@ export const updateStorage = async ( if (seasonQuestions === null) { return; } - const updatedSeasonQuestions = mergeByKey("id", updates, seasonQuestions).toSorted( + const updatedSeasonQuestions = mergeByKey("id", seasonQuestions, updates).toSorted( (a, b) => Number.parseInt(b.id) - Number.parseInt(a.id), ); await update(logger, updatedSeasonQuestions, SEASON_QUESTIONS_KEY); @@ -52,7 +52,7 @@ export const updateStorage = async ( if (questions === null) { return; } - const updatedQuestions = mergeByKey("id", updatedSeasonQuestions, questions).toSorted( + const updatedQuestions = mergeByKey("id", questions, updatedSeasonQuestions).toSorted( (a, b) => Number.parseInt(b.id) - Number.parseInt(a.id), ); await update(logger, updatedQuestions, ALL_QUESTIONS_KEY); From d348f6b29fa1f9e3c736dca2feb3f65beb3d6390 Mon Sep 17 00:00:00 2001 From: Battlesquid <25509915+Battlesquid@users.noreply.github.com> Date: Fri, 19 Jun 2026 19:46:08 -0700 Subject: [PATCH 2/2] chore: bump ver --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf0f4b1..21e1d2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qnaplus", - "version": "1.2.0", + "version": "1.2.1", "description": "", "private": true, "author": "battlesqui_d",