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
+5 -1
View File
@@ -56,8 +56,9 @@ func main() {
ensureIcons("web/static")
authH := handlers.NewAuthHandler(authMgr, repo, renderer)
homeH := handlers.NewHomeHandler(authMgr, renderer)
homeH := handlers.NewHomeHandler(authMgr, repo, renderer)
uploadH := handlers.NewUploadHandler(authMgr, repo, llmClient, renderer, cfg.DataDir)
questionH := handlers.NewQuestionHandler(authMgr, repo, renderer)
r := chi.NewRouter()
r.Use(middleware.RequestID)
@@ -85,6 +86,9 @@ func main() {
r.Post("/upload", uploadH.UploadPost)
r.Get("/import/{id}", uploadH.ImportGet)
r.Post("/import/{id}", uploadH.ImportPost)
r.Get("/questions/{id}", questionH.Show)
r.Post("/questions/{id}", questionH.Edit)
r.Post("/questions/{id}/delete", questionH.Delete)
})
srv := &http.Server{