Add some more functions for helping out

This commit is contained in:
2019-02-25 16:04:10 -06:00
parent 43d7a5806b
commit 96a75b058d
2 changed files with 56 additions and 4 deletions

View File

@@ -173,3 +173,21 @@ func (timer *Timer) ActiveOnDay(t time.Time) bool {
// Otherwise, if StartDate is before t and FinishDate is after t
return timer.StartDate.Before(t) && timer.FinishDate.After(t)
}
func (timer *Timer) HasContext(context string) bool {
for _, v := range timer.Contexts {
if v == context {
return true
}
}
return false
}
func (timer *Timer) HasProject(project string) bool {
for _, v := range timer.Projects {
if v == project {
return true
}
}
return false
}