From 80cedfcff88ba6ac1646ac3f3dbdd13260c576e7 Mon Sep 17 00:00:00 2001 From: Daniel Ledda Date: Sat, 7 Nov 2020 00:58:17 +0100 Subject: [PATCH] Changed endpoints and db queries, chart now shows suggested mins and maxes --- Database.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Database.go b/Database.go index 0b08311..0cfd131 100644 --- a/Database.go +++ b/Database.go @@ -40,7 +40,7 @@ func writeSnapshotToDb(snapshotSub *SnapshotSubmission) error { } func getSnapshotRecordsFromDb(minuteAgo int) ([]*SnapshotRecord, error) { - snapshots := make([]*SnapshotRecord, minuteAgo) + snapshots := make([]*SnapshotRecord) query := "SELECT `%s`, `%s`, `%s`, `%s`, `%s` FROM `snapshots` WHERE `%s` > date_sub(now(), interval %v minute) ORDER BY `id` DESC;" rows, err := ClimateDb.Query(fmt.Sprintf(query, "id", "temp", "humidity", "co2", "time", "time", minuteAgo)) if err != nil {