Almost there
This commit is contained in:
@@ -43,16 +43,17 @@ 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 := time.Now()
|
dateSince := time.Now().UTC().Format(time.RFC3339Nano)
|
||||||
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)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Redirect(w, r, ROOT_URL, 303)
|
http.Redirect(w, r, ROOT_URL, 303)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
dateSince = newDateSince
|
dateSince = newDateSince.Format(time.RFC3339Nano)
|
||||||
}
|
}
|
||||||
records, err := getSnapshotRecordsFromDb(dateSince.String())
|
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 }
|
||||||
json, err := createJsonFromSnapshotRecords(records)
|
json, err := createJsonFromSnapshotRecords(records)
|
||||||
if internalErrorOnErr(fmt.Errorf("couldn't create json from snapshots: %w", err), w, r) { return }
|
if internalErrorOnErr(fmt.Errorf("couldn't create json from snapshots: %w", err), w, r) { return }
|
||||||
|
|||||||
Reference in New Issue
Block a user