From faa79178a5fe20c3f679dd55620cc07f731e5e9a Mon Sep 17 00:00:00 2001 From: Pieter Hollander Date: Mon, 18 Mar 2024 10:45:27 +0100 Subject: [PATCH] Upgrade go version. --- Dockerfile | 2 +- main.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 39b4eea..d05c839 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use buildx for multi-architecture support -FROM --platform=${BUILDPLATFORM} golang:1.21 AS builder +FROM --platform=${BUILDPLATFORM} golang:1.22 AS builder WORKDIR /app diff --git a/main.go b/main.go index 5a0b625..312ed6b 100644 --- a/main.go +++ b/main.go @@ -445,14 +445,16 @@ func queryEventsEndpoint(inverterSerial string) (*EventsResponse, error) { } // The events counter reported by OpenDTU resets every day. +// Longest day NL: sun up 4:16, sun down 22:50 +// Shortest day NL: sun up 8:44, sun down 16:25 func getPreviousEventsCount(db *sql.DB, inverterSerial string) int { var count int err := db.QueryRow(` SELECT COUNT(*) FROM opendtu_events WHERE inverter_serial = $1 - AND timestamp >= CURRENT_DATE - AND timestamp < CURRENT_DATE + INTERVAL '1 day' + AND timestamp >= CURRENT_DATE + INTERVAL '9 hours' + AND timestamp < CURRENT_DATE + INTERVAL '23 hours' `, inverterSerial).Scan(&count) if err != nil && err != sql.ErrNoRows { logger.Error("Error querying previous events count", "error", err)