Changed endpoints and db queries, chart now shows suggested mins and maxes

This commit is contained in:
Daniel Ledda
2020-11-07 15:17:58 +01:00
parent 7eb97118b2
commit bb855aaa9b

View File

@@ -27,7 +27,7 @@ func CloseDb() {
} }
func writeSnapshotToDb(snapshotSub *SnapshotSubmission) (int64, error) { func writeSnapshotToDb(snapshotSub *SnapshotSubmission) (int64, error) {
queryStr := "INSERT INTO `snapshots` (`temp`, `humidity`, `co2`, `time`, `id`) VALUES (%v, %v, %v, '%v', NULL);" queryStr := "INSERT INTO `snapshots` (`temp`, `humidity`, `co2`, `time`, `id`) VALUES (?, ?, ?, '?', NULL);"
query, err := ClimateDb.Prepare(queryStr) query, err := ClimateDb.Prepare(queryStr)
if err != nil { if err != nil {
return -1, fmt.Errorf("couldn't prepare snapshot query: %w", err) return -1, fmt.Errorf("couldn't prepare snapshot query: %w", err)