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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user