Sessions: persist only if started

This commit is contained in:
andig 2022-12-05 10:17:19 +01:00
parent 818792dab1
commit 72863b6118

View file

@ -89,7 +89,9 @@ func (lp *LoadPoint) updateSession(opts ...sessionOption) {
// TODO remove
lp.log.DEBUG.Println("session updated")
lp.db.Persist(lp.session)
if !lp.session.Created.IsZero() {
lp.db.Persist(lp.session)
}
}
// clearSession clears the charging session without persisting it.