diff --git a/core/db/session.go b/core/db/session.go index 3167dcf28..180caab7d 100644 --- a/core/db/session.go +++ b/core/db/session.go @@ -30,7 +30,9 @@ type Session struct { // Stop stops charging session with end meter reading and due total amount func (t *Session) Stop(chargedWh, total float64) { - t.ChargedEnergy = chargedWh / 1e3 + if chargedEnergy := chargedWh / 1e3; chargedEnergy > t.ChargedEnergy { + t.ChargedEnergy = chargedEnergy + } t.MeterStop = total t.Finished = time.Now() }