skip penalties check when already solved
This commit is contained in:
26
klice.go
26
klice.go
@@ -231,18 +231,20 @@ func qrHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get penalties for this task and team
|
// get penalties for this task and team
|
||||||
err = db.QueryRow("SELECT minutes FROM penalties WHERE team_id = ? AND task_id = ?", teamID, taskID).Scan(&penalty)
|
if help == 0 {
|
||||||
if err == sql.ErrNoRows {
|
err = db.QueryRow("SELECT minutes FROM penalties WHERE team_id = ? AND task_id = ?", teamID, taskID).Scan(&penalty)
|
||||||
penalty = 0
|
if err == sql.ErrNoRows {
|
||||||
} else if err != nil {
|
penalty = 0
|
||||||
http.Error(w, "Could not retrieve penalties", http.StatusInternalServerError)
|
} else if err != nil {
|
||||||
return
|
http.Error(w, "Could not retrieve penalties", http.StatusInternalServerError)
|
||||||
}
|
return
|
||||||
// determine help level based on penalties
|
}
|
||||||
if penalty > 0 && penalty <= smallHelpPenalty {
|
// determine help level based on penalties
|
||||||
help = 1
|
if penalty > 0 && penalty <= smallHelpPenalty {
|
||||||
} else if penalty > smallHelpPenalty {
|
help = 1
|
||||||
help = 2
|
} else if penalty > smallHelpPenalty {
|
||||||
|
help = 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle answer and help form submission
|
// handle answer and help form submission
|
||||||
|
|||||||
Reference in New Issue
Block a user