Skip to content

Commit

Permalink
Add temporary session debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Nov 28, 2022
1 parent da35fad commit a2ae1e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func (s *DB) Session(meter float64) *Session {

// Persist creates or updates a transaction in the database
func (s *DB) Persist(session interface{}) {
// TODO remove
s.log.DEBUG.Printf("persist: %+v", session)

if err := s.db.Save(session).Error; err != nil {
s.log.ERROR.Printf("persist: %v", err)
}
Expand Down
9 changes: 9 additions & 0 deletions core/loadpoint_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func (lp *LoadPoint) startSession() {
}
}

// TODO remove
lp.log.DEBUG.Println("session started")

lp.db.Persist(lp.session)
}
}
Expand All @@ -51,6 +54,9 @@ func (lp *LoadPoint) stopSession() {

lp.session.Stop(lp.getChargedEnergy(), lp.chargeMeterTotal())

// TODO remove
lp.log.DEBUG.Println("session stopped")

lp.db.Persist(lp.session)
}

Expand All @@ -66,6 +72,9 @@ func (lp *LoadPoint) updateSession(opts ...sessionOption) {
opt(lp.session)
}

// TODO remove
lp.log.DEBUG.Println("session updated")

lp.db.Persist(lp.session)
}

Expand Down

0 comments on commit a2ae1e1

Please sign in to comment.