pdf-quiz-generator/backend/app/models
Daniel 45add79db3 Fix quiz delete (500 error), add trash bin, quiz resume, hide/publish, remove JS dialogs
Critical bug fix:
- DELETE /quizzes/{id} was returning 500 due to {\"quiz_id\": None} update using
  the DB column name instead of Python attribute name (source_quiz_id).
  Fixed with {QuestionModel.source_quiz_id: None, synchronize_session=False}

Extraction fix:
- Two-phase extraction was incorrectly triggering for PREP 2012/2014 format
  documents that have 'Preferred Response:' in their explanation text.
  Fix: check for inline 'Correct Answer:' first — if found, always use standard
  extraction regardless of 'Preferred Response:' appearing elsewhere.

Quiz trash bin:
- DELETE /quizzes/{id} now soft-deletes (sets deleted_at)
- GET /quizzes/trash — list deleted quizzes (moderator)
- PATCH /quizzes/{id}/restore — restore from trash
- DELETE /quizzes/{id}/permanent — permanent delete (must be in trash first)
- TrashPage.jsx — accessible via Settings → Admin → Trash

Hide/publish quizzes:
- is_published column on quizzes (1=visible, 0=hidden)
- PATCH /quizzes/{id}/publish?published=false — hide from regular users
- Moderators see all quizzes; regular users only see published
- 👁/🙈 toggle button per quiz card (moderators only)

Quiz progress resume (cross-browser via Redis):
- POST /attempts/progress — save {answers, current_idx, mode} to Redis (7 days)
- GET /attempts/progress?quiz_id=N — retrieve saved progress
- DELETE /attempts/progress/{quiz_id} — clear on submit
- QuizPage auto-saves to Redis every 1.5s (debounced) while in progress
- ModeSelectScreen loads saved progress from server, shows Resume button
- Works across browsers, devices, and after logout

Delete attempt:
- DELETE /attempts/{id} — user can delete own attempt + clears reminders for that quiz

ConfirmButton component:
- Replaces all window.confirm() / window.prompt() across the app
- Double-click pattern: first click shows [Confirm] [Cancel] inline
- Applied to: QuizzesPage, DocumentDetailPage, QuizEditPage, QuestionBankPage

Category delete (QuestionBankPage):
- window.prompt() replaced with inline modal dialog with select dropdown
- User chooses where to move questions before deletion

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 04:51:41 +02:00
..
__init__.py Initial commit: PDF Quiz Generator app 2026-03-30 20:04:53 +00:00
ai_model_config.py Initial commit: PDF Quiz Generator app 2026-03-30 20:04:53 +00:00
attempt.py Major platform update: pgvector search, multi-provider TTS, settings page, CLI 2026-03-31 18:03:10 +02:00
email_verification.py Major platform update: pgvector search, multi-provider TTS, settings page, CLI 2026-03-31 18:03:10 +02:00
password_reset.py Major platform update: pgvector search, multi-provider TTS, settings page, CLI 2026-03-31 18:03:10 +02:00
pdf_document.py Major platform update: pgvector search, multi-provider TTS, settings page, CLI 2026-03-31 18:03:10 +02:00
question.py Junction table for shared questions; verification blocking; semantic bank search; bug fixes 2026-04-01 00:55:13 +02:00
question_category.py Proper question bank system with question categories 2026-03-31 21:34:39 +02:00
quiz.py Fix quiz delete (500 error), add trash bin, quiz resume, hide/publish, remove JS dialogs 2026-04-01 04:51:41 +02:00
quiz_category.py Major: categories, question bank, security fixes, mobile layout, UX improvements 2026-03-31 20:08:05 +02:00
quiz_question_link.py Junction table for shared questions; verification blocking; semantic bank search; bug fixes 2026-04-01 00:55:13 +02:00
reminder.py Major platform update: pgvector search, multi-provider TTS, settings page, CLI 2026-03-31 18:03:10 +02:00
section.py Major platform update: pgvector search, multi-provider TTS, settings page, CLI 2026-03-31 18:03:10 +02:00
user.py Initial commit: PDF Quiz Generator app 2026-03-30 20:04:53 +00:00