napoveda k poloze

This commit is contained in:
2025-10-09 20:15:48 +02:00
parent 9f207a0f5c
commit 8fe76406d8

View File

@@ -289,15 +289,17 @@ func qrHandler(w http.ResponseWriter, r *http.Request) {
} }
CipherTemplateData.FinalClue = endClue CipherTemplateData.FinalClue = endClue
// get coordinates // get coordinates
var coordinates string var coordinates, positionHint string
err = db.QueryRow("SELECT gps FROM POSITIONS WHERE id = (SELECT position_id FROM TASKS WHERE id = (SELECT id FROM TASKS WHERE order_num = ? AND difficulty_level = (SELECT difficulty_level FROM teams WHERE id = ?)))", order+1, teamID).Scan(&coordinates) err = db.QueryRow("SELECT gps, clue FROM POSITIONS WHERE id = (SELECT position_id FROM TASKS WHERE id = (SELECT id FROM TASKS WHERE order_num = ? AND difficulty_level = (SELECT difficulty_level FROM teams WHERE id = ?)))", order+1, teamID).Scan(&coordinates, &positionHint)
if err == sql.ErrNoRows { if err == sql.ErrNoRows {
coordinates = "" coordinates = ""
positionHint = ""
} else if err != nil { } else if err != nil {
http.Error(w, "Could not retrieve coordinates", http.StatusInternalServerError) http.Error(w, "Could not retrieve coordinates", http.StatusInternalServerError)
return return
} }
CipherTemplateData.Coordinates = coordinates CipherTemplateData.Coordinates = coordinates
CipherTemplateData.PositionHint = positionHint
// get solution // get solution
var solution string var solution string
err = db.QueryRow("SELECT solution FROM CIPHERS WHERE id = ?", cipherID).Scan(&solution) err = db.QueryRow("SELECT solution FROM CIPHERS WHERE id = ?", cipherID).Scan(&solution)