quiz resetc
This commit is contained in:
@@ -170,11 +170,20 @@ func (h *QuizHandler) ParticipantResult(w http.ResponseWriter, r *http.Request)
|
||||
response.JSON(w, http.StatusOK, res)
|
||||
}
|
||||
|
||||
// ResetParticipant — DELETE /admin/quizzes/{id}/participants/{userID}. Deletes
|
||||
// that person's attempt so the quiz is pending for them again.
|
||||
func (h *QuizHandler) ResetParticipant(w http.ResponseWriter, r *http.Request) {
|
||||
if err := h.svc.ResetParticipant(r.Context(), chi.URLParam(r, "id"), chi.URLParam(r, "userID")); err != nil {
|
||||
writeQuizError(w, err)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
|
||||
// ── Users ─────────────────────────────────────────────────────────────────
|
||||
|
||||
// ForPath — GET /quizzes/for?path=… Optional auth: signed-out readers still
|
||||
// see that a quiz exists; signed-in ones also get their progress. Returns
|
||||
// null when the page has no quiz.
|
||||
// ForPath — GET /quizzes/for?path=… Signed in only; returns the quiz on that
|
||||
// page with the caller's progress, or null when the page has none.
|
||||
func (h *QuizHandler) ForPath(w http.ResponseWriter, r *http.Request) {
|
||||
card, err := h.svc.ForPath(r.Context(), middleware.UserID(r.Context()), r.URL.Query().Get("path"))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user