2021-02-06 21:52:50 +03:00
|
|
|
package models
|
|
|
|
|
2021-02-07 14:28:42 +03:00
|
|
|
// Support Wakapi and WakaTime range / interval identifiers
|
|
|
|
// See https://wakatime.com/developers/#summaries
|
|
|
|
var (
|
|
|
|
IntervalToday = &IntervalKey{"today", "Today"}
|
|
|
|
IntervalYesterday = &IntervalKey{"day", "yesterday", "Yesterday"}
|
|
|
|
IntervalThisWeek = &IntervalKey{"week", "This Week"}
|
|
|
|
IntervalLastWeek = &IntervalKey{"Last Week"}
|
|
|
|
IntervalThisMonth = &IntervalKey{"month", "This Month"}
|
|
|
|
IntervalLastMonth = &IntervalKey{"Last Month"}
|
|
|
|
IntervalThisYear = &IntervalKey{"year"}
|
|
|
|
IntervalPast7Days = &IntervalKey{"7_days", "last_7_days", "Last 7 Days"}
|
|
|
|
IntervalPast7DaysYesterday = &IntervalKey{"Last 7 Days from Yesterday"}
|
|
|
|
IntervalPast14Days = &IntervalKey{"Last 14 Days"}
|
|
|
|
IntervalPast30Days = &IntervalKey{"30_days", "last_30_days", "Last 30 Days"}
|
|
|
|
IntervalPast12Months = &IntervalKey{"12_months", "last_12_months"}
|
|
|
|
IntervalAny = &IntervalKey{"any"}
|
|
|
|
)
|
|
|
|
|
|
|
|
var AllIntervals = []*IntervalKey{
|
|
|
|
IntervalToday,
|
|
|
|
IntervalYesterday,
|
|
|
|
IntervalThisWeek,
|
|
|
|
IntervalLastWeek,
|
|
|
|
IntervalThisMonth,
|
|
|
|
IntervalLastMonth,
|
|
|
|
IntervalThisYear,
|
|
|
|
IntervalPast7Days,
|
|
|
|
IntervalPast7DaysYesterday,
|
|
|
|
IntervalPast14Days,
|
|
|
|
IntervalPast30Days,
|
|
|
|
IntervalPast12Months,
|
|
|
|
IntervalAny,
|
|
|
|
}
|
|
|
|
|
2021-02-06 21:52:50 +03:00
|
|
|
type IntervalKey []string
|
|
|
|
|
|
|
|
func (k *IntervalKey) HasAlias(s string) bool {
|
|
|
|
for _, e := range *k {
|
|
|
|
if e == s {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|