From 0ff6402c34ba3f4c37d89a6d787b0535247b769c Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Sun, 27 Sep 2020 22:32:01 -0600 Subject: [PATCH] Update and consolidate to-do list --- back/store.go | 2 -- front/server.go | 7 ------- todo.txt | 32 ++++++++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/back/store.go b/back/store.go index eb4de8f..b7e7fa8 100644 --- a/back/store.go +++ b/back/store.go @@ -22,8 +22,6 @@ type Store struct { } func NewStore(filename string, genString GenString) (*Store, error) { - // TODO This stat needs to change, though I can't remember how, now that - // SQLite has been updated. var needCreate bool if _, err := os.Stat(filename); os.IsNotExist(err) { needCreate = true diff --git a/front/server.go b/front/server.go index 8116e87..60febf0 100644 --- a/front/server.go +++ b/front/server.go @@ -268,7 +268,6 @@ func (h *handler) handleCreate(w http.ResponseWriter, r *http.Request) { } func (h *handler) handleDoCreate(w http.ResponseWriter, r *http.Request) { - // TODO consider redirecting to admin earliest, err := date.Parse(formDateLayout, r.FormValue(fieldNameEarliest)) if invalidForm(w, err) { return @@ -351,7 +350,6 @@ func (h *handler) handleCreateSuccess(w http.ResponseWriter, r *http.Request) { func (h *handler) handleAdmin(w http.ResponseWriter, r *http.Request) { query := r.URL.Query() eventID := query.Get(fieldNameEventID) - // TODO authenticate with admin code metadata, err := h.store.GetEventMetadata(context.Background(), back.GetEventMetadataQuery{ AlphaID: eventID, }) @@ -367,7 +365,6 @@ func (h *handler) handleAdmin(w http.ResponseWriter, r *http.Request) { return } - // TODO show results (number of responses, grid) body := hm.Terms{ e.Form()( e.Label(a.For(fieldNameEventName))(hm.Text("Event name")), @@ -381,8 +378,6 @@ func (h *handler) handleAdmin(w http.ResponseWriter, r *http.Request) { e.Textarea(a.Name(fieldNameDescription))(hm.Text(metadata.Description)), e.Br(), - // TODO Should the date fields be disabled, or should we cull invalid - // response times after changing event dates? e.Label(a.For(fieldNameEarliest))(hm.Text("Earliest date")), e.Input( a.Name(fieldNameEarliest), @@ -412,8 +407,6 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func (h *handler) writePage(w io.Writer, title string, contents hm.Term) error { - // TODO Need optional subtitles, and titles should be optional. - // Take a Page struct with title, subtitle, and contents. page := e.Html()( e.Head()( e.Title()(hm.Text(h.title+" — "+title)), diff --git a/todo.txt b/todo.txt index 567844e..efc7d77 100644 --- a/todo.txt +++ b/todo.txt @@ -1,8 +1,32 @@ +Essential: +------------ +Show results on admin page +Make earliest and latest dates required for creation +Prevent blank event names and guest names +Consider some front-end, regex-based field validation +Authenticate admin page with admin code + It might be sufficient to require that when getting the response summary. +Deal with the admin date fields + Should the date fields be disabled, or should we cull invalid + response times after changing event dates? +Consider redirecting from /create/do to admin + +Cleanup: +------------ Make the sqlite pool size configurable Get rid of the surrogate keys +Give response (and therefore response_time) a composite key Rename all of the alpha ID nonsense -Show results on admin page +Get rid of the Stat call in NewStore. + I can't remember the details. I think the old version + of sqlitex was panicking if I failed to open a DB file. + Maybe instead of statting, I would try to open an + existing file, but instead create it on failure. +Add optional subtitles to (*front.handler).writePage + Take a Page struct with title, subtitle, and contents. +Make titles optional in (*front.handler).writePage + + +More features: +--------------- Allow updating metadata on admin page -Prevent blank event names and guest names -Make earliest and latest dates required for creation -Consider some front-end, regex-based field validation