Upgrade go version.

This commit is contained in:
Pieter Hollander 2024-03-18 10:45:27 +01:00
parent d4028d37ec
commit faa79178a5
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg
2 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -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)