Skip to content

Exam generation: topic-based selection, delete, and unassign support - #169

Merged
kristofer merged 4 commits into
mainfrom
copilot/exam-generation-changes
Jul 15, 2026
Merged

kristofer merged 4 commits into
mainfrom
copilot/exam-generation-changes

Conversation

Copilot AI commented Jul 15, 2026 •

Copy link
Copy Markdown

Exam generation was limited to filtering by broad category values only, showed no way to target specific topics, and provided no mechanism to delete exams or remove assignments from individual students.

Backend

New ExamRepository methods (interface + SQLiteDB + InMemoryDB):

  • GetQuestionsByTopicIDs — filter questions by exact topic IDs instead of category strings
  • DeleteExam — delete exam with cascading removal of assignments/attempts
  • UnassignExamFromUser — remove a single exam assignment by exam+user ID

Updated GenerateExamHandler — accepts topic_ids []int (new) alongside existing categories []string (backward compatible); derives exam display labels via topicNamesFromIDs using actual topic names from DB rather than tags

New handlers + routes:

Method Route Purpose
GET /instructor/exams/topics All active topics with id/name/category
DELETE /instructor/exams?exam_id={id} Delete exam
DELETE /instructor/exams/unassign?exam_id={id}&user_id={id} Unassign student

Frontend (exams-page.js)

  • Replaced category checkboxes with topic checkboxes (from /instructor/exams/topics), grouped by category
  • generateExam() sends topic_ids instead of categories
  • Exam table row: added Delete button
  • Exam detail panel: added per-student Unassign button

Tests

New API-level tests for all four new handlers including not-found error paths.

Copilot AI linked an issue Jul 15, 2026 that may be closed by this pull request
Copilot AI added 3 commits July 15, 2026 16:29
- Show all available topics (not just distinct categories) in exam generation form
- Support generating exams from topic_ids in addition to categories
- Add DELETE /instructor/exams endpoint to delete exams
- Add DELETE /instructor/exams/unassign endpoint to unassign exams from students
- Add GET /instructor/exams/topics endpoint returning all active topics
- Update frontend to use topics, show delete/unassign buttons
- Add tests for new handlers
…frontend JS

- topicNamesFromIDs now resolves topic IDs via GetTopic for correct names
- Replace no-op shuffle with rand.Shuffle in GetQuestionsByTopicIDs
- Frontend: use module-level userId variable in unassign handler
- Frontend: store _currentDetailExamName alongside _currentDetailExamId
Copilot AI changed the title [WIP] Update exam generation to support multiple topics Exam generation: topic-based selection, delete, and unassign support Jul 15, 2026
Copilot AI requested a review from kristofer July 15, 2026 16:36
@kristofer
kristofer marked this pull request as ready for review July 15, 2026 19:11
@kristofer
kristofer merged commit e4defe5 into main Jul 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exam generation changes.

2 participants