summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder (aider) <wohilas@gmail.com>2025-04-05 14:43:04 +0300
committerGrail Finder (aider) <wohilas@gmail.com>2025-04-05 14:43:04 +0300
commit7243b0492390bb870084717800a0015dede3a5bc (patch)
tree6f4e61ca95da5cb45516b84e1e44a9a592c60ab4
parentad4324a692f623314d6b1ff81983a8d9dc6f9fa2 (diff)
fix: update question model fields and feedback check
-rw-r--r--internal/handlers/main.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/handlers/main.go b/internal/handlers/main.go
index 7e3bfa0..686b0ce 100644
--- a/internal/handlers/main.go
+++ b/internal/handlers/main.go
@@ -1,8 +1,9 @@
package handlers
import (
+ "fmt"
"demoon/config"
- "demoon/internal/database/repos"
+ "demoon/internal/database/repos"
"demoon/internal/models"
"html/template"
"log/slog"
@@ -50,7 +51,7 @@ func (h *Handlers) HandleAnswer(w http.ResponseWriter, r *http.Request) {
"question_id", questionID)
var feedback string
- if selectedIndex == "1" {
+ if selectedIndex == fmt.Sprint(question.CorrectIndex) {
feedback = `<div class="feedback">Correct! 🎉</div>`
} else {
feedback = `<div class="feedback">Wrong answer, try again! ❌</div>`
@@ -70,10 +71,15 @@ func (h *Handlers) MainPage(w http.ResponseWriter, r *http.Request) {
ID: 1,
Text: "___ du keine Zweifel daran?",
Option1: "Haben",
- Option2: "Hast",
+ Option2: "Hast",
Option3: "Hat",
Option4: "Habt",
CorrectIndex: 1,
+ Requirement: "Choose the correct verb form",
+ Explanation: "Use 'Hast' for 2nd person singular",
+ Status: 0,
+ ExamID: 1,
+ MixedID: 101,
}
err = tmpl.ExecuteTemplate(w, "main", testQuestion)
if err != nil {