Skip to content

Commit 8fdf35e

Browse files
authored
Merge pull request #14 from nigelm/monthly_stats
Monthly stats modifications - fixes #13
2 parents 75b2e3b + 1796794 commit 8fdf35e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

cmd/carwings/main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func runMonthly(s *carwings.Session, cfg config, args []string) error {
406406
fmt.Printf("Monthly Driving Statistics for %s\n", time.Now().Local().Format("January 2006"))
407407
fmt.Printf(" Driving efficiency: %.4f %s over %s in %d trips\n",
408408
ms.Total.Efficiency*1000, ms.EfficiencyScale, prettyUnits(cfg.units, ms.Total.MetersTravelled), ms.Total.Trips)
409-
fmt.Printf(" Driving cost: %.4f at a rate of %.4f/kWh for %.1fkWh => %.4f/%s\n",
409+
fmt.Printf(" Driving cost: %.4f at a rate of %.4f/kWh for %.1f kWh => %.4f/%s\n",
410410
ms.ElectricityBill, ms.ElectricityRate, ms.Total.PowerConsumed, ms.ElectricityBill/metersToUnits(cfg.units, ms.Total.MetersTravelled), cfg.units)
411411
fmt.Println()
412412

@@ -422,14 +422,14 @@ func runMonthly(s *carwings.Session, cfg config, args []string) error {
422422
distance += t.Meters
423423
power += t.PowerConsumedTotal
424424

425-
fmt.Printf(" %5s %s %5.1f %-10.10s\n", t.Started.Local().Format("15:04"),
426-
prettyUnits(cfg.units, t.Meters), t.Efficiency, ms.EfficiencyScale)
425+
fmt.Printf(" %5s %6.1f %s %5.1f %-10.10s %6.1f kWh\n", t.Started.Local().Format("15:04"),
426+
metersToUnits(cfg.units, t.Meters), cfg.units, t.Efficiency, ms.EfficiencyScale, t.PowerConsumedTotal/1000)
427427
}
428428
if distance > 0 {
429-
fmt.Println(" ======= =======")
430-
efficiency := (power / metersToUnits(cfg.units, distance)) / 10
431-
fmt.Printf(" %5.1f%s %5.1f %-10.10s\n\n",
432-
metersToUnits(cfg.units, distance), cfg.units, efficiency, ms.EfficiencyScale)
429+
fmt.Println(" ============ ============== ============")
430+
efficiency := (power / metersToUnits(cfg.units, distance)) / 1000
431+
fmt.Printf(" %6.1f %s %5.1f %-10.10s %6.1f kWh\n\n",
432+
metersToUnits(cfg.units, distance), cfg.units, efficiency, ms.EfficiencyScale, power/1000)
433433
}
434434
}
435435

0 commit comments

Comments
 (0)