summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-04-06 09:27:33 +0300
committerGrail Finder (aider) <wohilas@gmail.com>2025-04-06 09:27:33 +0300
commit42018ec3137dd2af5c84567e7b603f0eaf055048 (patch)
tree265e4644dc0cbd69c6295598cdb0d236f1a1082e
parentb5343e90084f6bc8934065f16ef1167320791050 (diff)
refactor: update SQL query and remove question template
-rw-r--r--components/index.html71
-rw-r--r--internal/database/repos/questions.go2
2 files changed, 1 insertions, 72 deletions
diff --git a/components/index.html b/components/index.html
index 7d4552f..00df90f 100644
--- a/components/index.html
+++ b/components/index.html
@@ -10,77 +10,6 @@
</head>
<body>
<div id="ancestor">
- {{if .Requirement}}
- <p>{{.Requirement}}</p>
- {{end}}
- <div class="question-text" data-testid="question">
- {{.Text}}
- </div>
- <div id="reaction">
- {{if eq .Status 1}}
- Correct!
- {{end}}
- {{if eq .Status 2}}
- Wrong.
- {{end}}
- </div>
- <div id="feedback" data-testid="feedback">
- {{if ne .Status 0}}
- <div>
- {{.Explanation}}
- </div>
- <button
- hx-get="/next-question?current_id={{.ID}}"
- hx-target="#ancestor"
- hx-swap="outerHTML"
- class="next-button"
- data-testid="next-button">
- Next Question →
- </button>
- {{end}}
- </div>
- <div id="options">
- <button
- data-testid="option1"
- hx-post="/answer"
- hx-vals='{"selected": "0", "question_id": "{{.ID}}"}'
- hx-target="#ancestor"
- hx-swap="innerHTML"
- class="option-button"
- >
- {{.Option1}}
- </button>
- <button
- data-testid="option2"
- hx-post="/answer"
- hx-vals='{"selected": "1", "question_id": "{{.ID}}"}'
- hx-target="#ancestor"
- hx-swap="innerHTML"
- class="option-button"
- >
- {{.Option2}}
- </button>
- <button
- data-testid="option3"
- hx-post="/answer"
- hx-vals='{"selected": "2", "question_id": "{{.ID}}"}'
- hx-target="#ancestor"
- hx-swap="innerHTML"
- class="option-button"
- >
- {{.Option3}}
- </button>
- <button
- data-testid="option4"
- hx-post="/answer"
- hx-vals='{"selected": "3", "question_id": "{{.ID}}"}'
- hx-target="#ancestor"
- hx-swap="innerHTML"
- class="option-button"
- >
- {{.Option4}}
- </button>
- </div>
</div>
</body>
</html>
diff --git a/internal/database/repos/questions.go b/internal/database/repos/questions.go
index f444b05..ab5e093 100644
--- a/internal/database/repos/questions.go
+++ b/internal/database/repos/questions.go
@@ -9,7 +9,7 @@ type QuestionsRepo interface {
func (p *Provider) DBGetMixedUbung(id uint32) (*models.MixedUbung, error) {
var ubung models.MixedUbung
- err := p.db.Get(&ubung, "SELECT * FROM mixed_ubungs WHERE mixed_id = ?", id)
+ err := p.db.Get(&ubung, "SELECT * FROM Table_Mixed WHERE mixedid = ?", id)
if err != nil {
return nil, err
}