Updated TimerList struct
This commit is contained in:
@@ -34,12 +34,13 @@ func opStatus(cmd *cobra.Command, args []string) error {
|
||||
if err := p.LoadTimerList(); err != nil {
|
||||
return fmt.Errorf("Error loading timer list: %w", err)
|
||||
}
|
||||
if len(*p.TimerList.GetActiveTimers()) == 0 {
|
||||
active := p.TimerList.GetActiveTimers().GetTimerSlice()
|
||||
if len(active) == 0 {
|
||||
fmt.Println("No timers running")
|
||||
return nil
|
||||
}
|
||||
var currDur time.Duration
|
||||
for _, v := range *p.TimerList {
|
||||
for _, v := range active {
|
||||
if v.ActiveToday() {
|
||||
currDur += v.Duration()
|
||||
}
|
||||
@@ -47,7 +48,7 @@ func opStatus(cmd *cobra.Command, args []string) error {
|
||||
d := util.Round(currDur)
|
||||
|
||||
fmt.Printf("%s ( %.2f hrs )\n", time.Now().Format(time.Stamp), util.DurationToDecimal(d))
|
||||
for _, v := range *p.TimerList.GetActiveTimers() {
|
||||
for _, v := range active {
|
||||
fmt.Println(util.TimerToFriendlyString(v))
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user