[PR #1946] [MERGED] fix(socratiq): correct IndexedDB store name and key in getIncorrectQuestions() #32210

Closed
opened 2026-07-12 08:52:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1946
Author: @farhan523
Created: 7/7/2026
Status: Merged
Merged: 7/10/2026
Merged by: @profvjreddi

Base: devHead: fix/socratiq-incorrect-questions-store


📝 Commits (1)

  • a979097 fix(socratiq): correct IndexedDB store name and key in getIncorrectQuestions()

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 socratiq/src_shadow/js/components/quiz/quiz-storage.js (+1 -1)

📄 Description

Problem

getIncorrectQuestions() in socratiq/src_shadow/js/components/quiz/quiz-storage.js reads from an IndexedDB store that does not exist:

const incorrectQuestions = await dbManager.getByKey('ongoing-incorrect-questions');
  • The store defined in db_configs_one.js is ongoingIncorrectQuestions (camelCase). The hyphenated name appears nowhere else in the codebase, so opening a transaction on it throws NotFoundError.
  • The call also passes no key, while the writer updateIncorrectQuestions() stores the record under the fixed id 'current'. Every other getByKey call in the codebase passes (storeName, key).

Incorrect quiz answers are being recorded on every quiz submission today (saveQuizResult → updateIncorrectQuestions), but this bug made that data unretrievable.

Fix

One line — read from the same store and key the writer uses:

const incorrectQuestions = await dbManager.getByKey('ongoingIncorrectQuestions', 'current');

Notes

  • This unblocks re-enabling the "study past incorrect questions" feature (initiateStudyBtn, currently commented out at index.js:107 / index.js:616) — as written it would have thrown on first click.
  • No bundle rebuild needed: since the feature is disabled, this module is tree-shaken out of book/quarto/tools/scripts/socratiQ/bundle.js, so built output is unchanged.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1946 **Author:** [@farhan523](https://github.com/farhan523) **Created:** 7/7/2026 **Status:** ✅ Merged **Merged:** 7/10/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `fix/socratiq-incorrect-questions-store` --- ### 📝 Commits (1) - [`a979097`](https://github.com/harvard-edge/cs249r_book/commit/a979097c5ae2884335e322693a52d1ddab04b335) fix(socratiq): correct IndexedDB store name and key in getIncorrectQuestions() ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `socratiq/src_shadow/js/components/quiz/quiz-storage.js` (+1 -1) </details> ### 📄 Description ## Problem `getIncorrectQuestions()` in `socratiq/src_shadow/js/components/quiz/quiz-storage.js` reads from an IndexedDB store that does not exist: ```js const incorrectQuestions = await dbManager.getByKey('ongoing-incorrect-questions'); ``` - The store defined in `db_configs_one.js` is `ongoingIncorrectQuestions` (camelCase). The hyphenated name appears nowhere else in the codebase, so opening a transaction on it throws `NotFoundError`. - The call also passes no key, while the writer `updateIncorrectQuestions()` stores the record under the fixed id `'current'`. Every other `getByKey` call in the codebase passes `(storeName, key)`. Incorrect quiz answers **are** being recorded on every quiz submission today (`saveQuizResult → updateIncorrectQuestions`), but this bug made that data unretrievable. ## Fix One line — read from the same store and key the writer uses: ```js const incorrectQuestions = await dbManager.getByKey('ongoingIncorrectQuestions', 'current'); ``` ## Notes - This unblocks re-enabling the "study past incorrect questions" feature (`initiateStudyBtn`, currently commented out at `index.js:107` / `index.js:616`) — as written it would have thrown on first click. - No bundle rebuild needed: since the feature is disabled, this module is tree-shaken out of `book/quarto/tools/scripts/socratiQ/bundle.js`, so built output is unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-07-12 08:52:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#32210