diff --git a/models/interval.go b/models/interval.go index d4b984e..85642a3 100644 --- a/models/interval.go +++ b/models/interval.go @@ -14,6 +14,7 @@ var ( IntervalPast7DaysYesterday = &IntervalKey{"Last 7 Days from Yesterday"} IntervalPast14Days = &IntervalKey{"Last 14 Days"} IntervalPast30Days = &IntervalKey{"30_days", "last_30_days", "Last 30 Days"} + IntervalPast6Months = &IntervalKey{"6_months", "last_6_months"} IntervalPast12Months = &IntervalKey{"12_months", "last_12_months", "last_year"} IntervalAny = &IntervalKey{"any", "all_time"} ) @@ -30,6 +31,7 @@ var AllIntervals = []*IntervalKey{ IntervalPast7DaysYesterday, IntervalPast14Days, IntervalPast30Days, + IntervalPast6Months, IntervalPast12Months, IntervalAny, } diff --git a/routes/api/summary.go b/routes/api/summary.go index 44aca6d..ac013e8 100644 --- a/routes/api/summary.go +++ b/routes/api/summary.go @@ -37,7 +37,7 @@ func (h *SummaryApiHandler) RegisterRoutes(router *mux.Router) { // @ID get-summary // @Tags summary // @Produce json -// @Param interval query string false "Interval identifier" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 12_months, last_12_months, any) +// @Param interval query string false "Interval identifier" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 6_months, last_6_months, 12_months, last_12_months, last_year, any, all_time) // @Param from query string false "Start date (e.g. '2021-02-07')" // @Param to query string false "End date (e.g. '2021-02-08')" // @Param recompute query bool false "Whether to recompute the summary from raw heartbeat or use cache" diff --git a/routes/compat/shields/v1/badge.go b/routes/compat/shields/v1/badge.go index 48ff935..854d9d2 100644 --- a/routes/compat/shields/v1/badge.go +++ b/routes/compat/shields/v1/badge.go @@ -43,7 +43,7 @@ func (h *BadgeHandler) RegisterRoutes(router *mux.Router) { // @Tags badges // @Produce json // @Param user path string true "User ID to fetch data for" -// @Param interval path string true "Interval to aggregate data for" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 12_months, last_12_months, any) +// @Param interval path string true "Interval to aggregate data for" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 6_months, last_6_months, 12_months, last_12_months, last_year, any, all_time) // @Param filter path string true "Filter to apply (e.g. 'project:wakapi' or 'language:Go')" // @Success 200 {object} v1.BadgeData // @Router /compat/shields/v1/{user}/{interval}/{filter} [get] diff --git a/routes/compat/wakatime/v1/stats.go b/routes/compat/wakatime/v1/stats.go index 5399742..c463e1d 100644 --- a/routes/compat/wakatime/v1/stats.go +++ b/routes/compat/wakatime/v1/stats.go @@ -48,7 +48,7 @@ func (h *StatsHandler) RegisterRoutes(router *mux.Router) { // @Tags wakatime // @Produce json // @Param user path string true "User ID to fetch data for (or 'current')" -// @Param range path string false "Range interval identifier" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 12_months, last_12_months, any) +// @Param range path string false "Range interval identifier" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 6_months, last_6_months, 12_months, last_12_months, last_year, any, all_time) // @Param project query string false "Project to filter by" // @Param language query string false "Language to filter by" // @Param editor query string false "Editor to filter by" diff --git a/routes/compat/wakatime/v1/summaries.go b/routes/compat/wakatime/v1/summaries.go index 54ac005..62be34c 100644 --- a/routes/compat/wakatime/v1/summaries.go +++ b/routes/compat/wakatime/v1/summaries.go @@ -50,7 +50,7 @@ func (h *SummariesHandler) RegisterRoutes(router *mux.Router) { // @Tags wakatime // @Produce json // @Param user path string true "User ID to fetch data for (or 'current')" -// @Param range query string false "Range interval identifier" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 12_months, last_12_months, any) +// @Param range query string false "Range interval identifier" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 6_months, last_6_months, 12_months, last_12_months, last_year, any, all_time) // @Param start query string false "Start date (e.g. '2021-02-07')" // @Param end query string false "End date (e.g. '2021-02-08')" // @Param project query string false "Project to filter by" diff --git a/static/docs/docs.go b/static/docs/docs.go index 704c291..e4841b9 100644 --- a/static/docs/docs.go +++ b/static/docs/docs.go @@ -54,9 +54,13 @@ const docTemplate = `{ "last_7_days", "30_days", "last_30_days", + "6_months", + "last_6_months", "12_months", "last_12_months", - "any" + "last_year", + "any", + "all_time" ], "type": "string", "description": "Interval to aggregate data for", @@ -354,9 +358,13 @@ const docTemplate = `{ "last_7_days", "30_days", "last_30_days", + "6_months", + "last_6_months", "12_months", "last_12_months", - "any" + "last_year", + "any", + "all_time" ], "type": "string", "description": "Range interval identifier", @@ -445,9 +453,13 @@ const docTemplate = `{ "last_7_days", "30_days", "last_30_days", + "6_months", + "last_6_months", "12_months", "last_12_months", - "any" + "last_year", + "any", + "all_time" ], "type": "string", "description": "Range interval identifier", @@ -809,9 +821,13 @@ const docTemplate = `{ "last_7_days", "30_days", "last_30_days", + "6_months", + "last_6_months", "12_months", "last_12_months", - "any" + "last_year", + "any", + "all_time" ], "type": "string", "description": "Interval identifier", diff --git a/static/docs/swagger.json b/static/docs/swagger.json index 17702e6..275338a 100644 --- a/static/docs/swagger.json +++ b/static/docs/swagger.json @@ -46,9 +46,13 @@ "last_7_days", "30_days", "last_30_days", + "6_months", + "last_6_months", "12_months", "last_12_months", - "any" + "last_year", + "any", + "all_time" ], "type": "string", "description": "Interval to aggregate data for", @@ -346,9 +350,13 @@ "last_7_days", "30_days", "last_30_days", + "6_months", + "last_6_months", "12_months", "last_12_months", - "any" + "last_year", + "any", + "all_time" ], "type": "string", "description": "Range interval identifier", @@ -437,9 +445,13 @@ "last_7_days", "30_days", "last_30_days", + "6_months", + "last_6_months", "12_months", "last_12_months", - "any" + "last_year", + "any", + "all_time" ], "type": "string", "description": "Range interval identifier", @@ -801,9 +813,13 @@ "last_7_days", "30_days", "last_30_days", + "6_months", + "last_6_months", "12_months", "last_12_months", - "any" + "last_year", + "any", + "all_time" ], "type": "string", "description": "Interval identifier", diff --git a/static/docs/swagger.yaml b/static/docs/swagger.yaml index 7a2c0e5..412d871 100644 --- a/static/docs/swagger.yaml +++ b/static/docs/swagger.yaml @@ -430,9 +430,13 @@ paths: - last_7_days - 30_days - last_30_days + - 6_months + - last_6_months - 12_months - last_12_months + - last_year - any + - all_time in: path name: interval required: true @@ -623,9 +627,13 @@ paths: - last_7_days - 30_days - last_30_days + - 6_months + - last_6_months - 12_months - last_12_months + - last_year - any + - all_time in: path name: range type: string @@ -686,9 +694,13 @@ paths: - last_7_days - 30_days - last_30_days + - 6_months + - last_6_months - 12_months - last_12_months + - last_year - any + - all_time in: query name: range type: string @@ -925,9 +937,13 @@ paths: - last_7_days - 30_days - last_30_days + - 6_months + - last_6_months - 12_months - last_12_months + - last_year - any + - all_time in: query name: interval type: string diff --git a/utils/summary.go b/utils/summary.go index a4f9823..e2f62e9 100644 --- a/utils/summary.go +++ b/utils/summary.go @@ -60,6 +60,8 @@ func ResolveIntervalTZ(interval *models.IntervalKey, tz *time.Location) (err err from = now.AddDate(0, 0, -14) case models.IntervalPast30Days: from = now.AddDate(0, 0, -30) + case models.IntervalPast6Months: + from = now.AddDate(0, -6, 0) case models.IntervalPast12Months: from = now.AddDate(0, -12, 0) case models.IntervalAny: diff --git a/views/time-picker.tpl.html b/views/time-picker.tpl.html index 876638e..589db8f 100644 --- a/views/time-picker.tpl.html +++ b/views/time-picker.tpl.html @@ -14,6 +14,7 @@ This Year Past 7 Days Past 30 Days + Past 6 Months Past 12 Months All Time