UI changes for problems

This commit is contained in:
Magnus Åhall 2024-07-04 15:14:24 +02:00
parent 332788dd20
commit 09241e73a5
18 changed files with 125 additions and 40 deletions

12
main.go
View file

@ -535,7 +535,15 @@ func pageProblems(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{
return
}
problems, err := ProblemsRetrieve(true, timeFrom, timeTo)
// GET parameters for this page
var selection string
if r.URL.Query().Get("selection") == "all" {
selection = "ALL"
} else {
selection = "CURRENT"
}
problems, err := ProblemsRetrieve(selection == "ALL", timeFrom, timeTo)
if err != nil {
httpError(w, werr.Wrap(err).Log())
return
@ -560,7 +568,9 @@ func pageProblems(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{
page.Data = map[string]any{
"Problems": problems,
"ProblemsGrouped": problemsGrouped,
"Selection": selection,
"TimeHidden": selection == "CURRENT",
"TimeSubmit": "/problems",
"TimeFrom": timeFrom.Format("2006-01-02T15:04:05"),
"TimeTo": timeTo.Format("2006-01-02T15:04:05"),