Skip to content

Commit

Permalink
chore: refactor go-stylish
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jun 8, 2023
1 parent a64e958 commit a179ee2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions vehicle/seat/cupra/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ var _ api.VehicleFinishTimer = (*Provider)(nil)
// FinishTime implements the api.VehicleFinishTimer interface
func (v *Provider) FinishTime() (time.Time, error) {
res, err := v.statusG()
if err == nil {
rsc := res.Services.Charging
if !rsc.Active {
return time.Time{}, api.ErrNotAvailable
}
if err != nil {
return time.Time{}, err
}

rt := rsc.RemainingTime
if rsc.TargetPct > 0 && rsc.TargetPct < 100 {
rt = rt * 100 / int64(rsc.TargetPct)
}
rsc := res.Services.Charging
if !rsc.Active {
return time.Time{}, api.ErrNotAvailable
}

return time.Now().Add(time.Duration(rt) * time.Minute), err
rt := rsc.RemainingTime
if rsc.TargetPct > 0 && rsc.TargetPct < 100 {
rt = rt * 100 / int64(rsc.TargetPct)
}

return time.Time{}, err
return time.Now().Add(time.Duration(rt) * time.Minute), nil
}

var _ api.VehicleRange = (*Provider)(nil)
Expand Down

0 comments on commit a179ee2

Please sign in to comment.