token-validator: update dashboard: include visualization for individual student

This commit is contained in:
nemunaire 2020-04-26 23:56:44 +02:00
commit 85ad80a671
5 changed files with 130 additions and 39 deletions

View file

@ -8,7 +8,6 @@ import (
"os"
"path"
"path/filepath"
"strconv"
"strings"
"github.com/julienschmidt/httprouter"
@ -49,11 +48,7 @@ func init() {
http.ServeFile(w, r, path.Join(StaticDir, "dashboard.html"))
})
Router().GET("/dashboard/:where", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
if _, err := strconv.ParseInt(string(ps.ByName("where")), 10, 64); err != nil {
http.NotFound(w, r)
} else {
http.ServeFile(w, r, path.Join(StaticDir, "dashboard.html"))
}
http.ServeFile(w, r, path.Join(StaticDir, "dashboard.html"))
})
Router().GET("/dashboard/:where/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/dashboard")