Upgrade go version.
This commit is contained in:
parent
d4028d37ec
commit
faa79178a5
2 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
6
main.go
6
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)
|
||||
|
|
Loading…
Reference in a new issue