Sessions: fix session energy nulled when charger already disconnected
This commit is contained in:
parent
24f49585b9
commit
7d3619f8f7
1 changed files with 3 additions and 1 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue