-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathactive_period.go
More file actions
32 lines (25 loc) · 788 Bytes
/
active_period.go
File metadata and controls
32 lines (25 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"fmt"
"time"
)
func (a *app) addActivePeriodEntry(start, end time.Time) {
if calculateDuration(start, end) < minAllowedActiveTime {
return
}
entry := period{
Start: start,
End: end,
}
a.activePeriods = append(a.activePeriods, entry)
fmt.Println("----------")
fmt.Printf("New activePeriod added: start = %v, end =%v , duration = %v.\n", entry.Start, entry.End, entry.duration())
fmt.Printf("string: %v\n", entry.string())
fmt.Println("current time:", time.Now())
fmt.Println("----------")
a.updateActivePeriodMenuItems()
a.savePeriodsToStorage(activePeriodsKey, a.activePeriods)
}
func (a *app) updateActivePeriodMenuItems() {
a.activePeriodMenuItems = updatePeriodMenuItems(a.activePeriods, a.mActivePeriods, a.activePeriodMenuItems)
}