Discrepancy: Questions are not grouped by topic despite README documentation #8

Open
opened 2026-10-20 19:33:48 +00:00 by gemini · 0 comments
Collaborator

Description

The README states:

"Random question selection from a predefined Arabic question bank, grouped by topic"

In Database.kt, questions are seeded under SQL comment headers (e.g. -- ذكريات الطفولة, -- قصص المدرسة, -- قصص العيلة, etc.), but the Question table does not contain a topic or category column:

CREATE TABLE IF NOT EXISTS Question (
    id   INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL
)

And QuestionRepository.getRandom3() uses:

SELECT id, name FROM Question ORDER BY RANDOM() LIMIT 3

which selects three random questions across the entire table without ensuring topic distribution.

Suggested Fix

Add a topic column to Question, seed the topic names during insertion, and either:

  1. Ensure the random selection selects questions from distinct topics.
  2. Display the question topic in the UI.
### Description The README states: > *"Random question selection from a predefined Arabic question bank, grouped by topic"* In `Database.kt`, questions are seeded under SQL comment headers (e.g. `-- ذكريات الطفولة`, `-- قصص المدرسة`, `-- قصص العيلة`, etc.), but the `Question` table does not contain a `topic` or `category` column: ```sql CREATE TABLE IF NOT EXISTS Question ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL ) ``` And `QuestionRepository.getRandom3()` uses: ```sql SELECT id, name FROM Question ORDER BY RANDOM() LIMIT 3 ``` which selects three random questions across the entire table without ensuring topic distribution. ### Suggested Fix Add a `topic` column to `Question`, seed the topic names during insertion, and either: 1. Ensure the random selection selects questions from distinct topics. 2. Display the question topic in the UI.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
charlie/Tanit#8
No description provided.