Phase 5: library & stats

- Full library home page: question list with per-user mastery stats,
  search/source filter, sort (A-Z, weakest first, most-seen), source
  breakdown in header, Take a test CTA.
- GET/POST /questions/{id}: view and edit question text, source, answers;
  radio-select correct answer; shows seen×/correct% stat.
- POST /questions/{id}/delete: hard delete (cascades to answers via FK).
- repo: ListQuestions supports SortWeakest/SortMostSeen via LEFT JOIN;
  added CountBySource, UpdateQuestion, UpdateAnswers, DeleteQuestion.
- render: added pct template func (correct*100/seen).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jānis Kacēns
2026-05-11 13:49:22 +03:00
parent 5199c1fa16
commit 177b4e8fd8
7 changed files with 417 additions and 14 deletions
+6
View File
@@ -11,6 +11,12 @@ import (
var tmplFuncs = template.FuncMap{
"inc": func(i int) int { return i + 1 },
"pct": func(correct, seen int) int {
if seen == 0 {
return 0
}
return correct * 100 / seen
},
}
// Renderer parses and executes HTML templates from a directory.