From c30ab382560ddbed5c90043090c78fbb56b5fffa Mon Sep 17 00:00:00 2001 From: "Grail Finder (aider)" Date: Sat, 29 Mar 2025 15:07:04 +0300 Subject: feat: return HTML feedback for answers --- internal/handlers/main.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'internal') diff --git a/internal/handlers/main.go b/internal/handlers/main.go index 86d0915..c167cae 100644 --- a/internal/handlers/main.go +++ b/internal/handlers/main.go @@ -49,9 +49,15 @@ func (h *Handlers) HandleAnswer(w http.ResponseWriter, r *http.Request) { "selected", selectedIndex, "question_id", questionID) - // TODO: Add actual answer validation logic here - // For now just return the same question - h.MainPage(w, r) + var feedback string + if selectedIndex == "1" { + feedback = `
Correct! 🎉
` + } else { + feedback = `
Wrong answer, try again! ❌
` + } + + w.Header().Set("Content-Type", "text/html") + w.Write([]byte(feedback)) } func (h *Handlers) MainPage(w http.ResponseWriter, r *http.Request) { -- cgit v1.2.3