Almost there

This commit is contained in:
Daniel Ledda
2020-11-14 16:00:00 +01:00
parent f246e6990b
commit 8543ff12b5

View File

@@ -43,7 +43,7 @@ func showCharts(w http.ResponseWriter, r *http.Request) {
} }
func sendData(w http.ResponseWriter, r *http.Request) { func sendData(w http.ResponseWriter, r *http.Request) {
dateSince := strings.SplitAfter(time.Now().UTC().Format(time.RFC3339Nano), "Z")[0] dateSince := strings.Split(time.Now().UTC().Format(time.RFC3339Nano), "Z")[0]
sinceQuery := r.FormValue("since") sinceQuery := r.FormValue("since")
if sinceQuery != "" { if sinceQuery != "" {
newDateSince, err := time.Parse(time.RFC3339Nano, sinceQuery) newDateSince, err := time.Parse(time.RFC3339Nano, sinceQuery)
@@ -51,7 +51,7 @@ func sendData(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, ROOT_URL, 303) http.Redirect(w, r, ROOT_URL, 303)
return return
} }
dateSince = strings.SplitAfter(newDateSince.Format(time.RFC3339Nano), "Z")[0] dateSince = strings.Split(newDateSince.Format(time.RFC3339Nano), "Z")[0]
} }
records, err := getSnapshotRecordsFromDb(dateSince) records, err := getSnapshotRecordsFromDb(dateSince)
if internalErrorOnErr(fmt.Errorf("couldn't get snapshots from db: %w", err), w, r) { return } if internalErrorOnErr(fmt.Errorf("couldn't get snapshots from db: %w", err), w, r) { return }