mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
Add last_6_months interval identifier
This commit is contained in:
parent
4bfc8a9e9f
commit
9505773165
@ -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,
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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]
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -14,6 +14,7 @@
|
||||
<a id="time-option-year" class="submenu-item hover:bg-gray-800 rounded p-1 text-right w-full text-gray-300 px-2 font-semibold text-sm" :href="intervalLink('year')" @click="state.showDropdownTimepicker = !state.showDropdownTimepicker" data-trigger-for="showDropdownTimepicker">This Year</a>
|
||||
<a id="time-option-last_7_days" class="submenu-item hover:bg-gray-800 rounded p-1 text-right w-full text-gray-300 px-2 font-semibold text-sm" :href="intervalLink('last_7_days')" @click="state.showDropdownTimepicker = !state.showDropdownTimepicker" data-trigger-for="showDropdownTimepicker">Past 7 Days</a>
|
||||
<a id="time-option-last_30_days" class="submenu-item hover:bg-gray-800 rounded p-1 text-right w-full text-gray-300 px-2 font-semibold text-sm" :href="intervalLink('last_30_days')" @click="state.showDropdownTimepicker = !state.showDropdownTimepicker" data-trigger-for="showDropdownTimepicker">Past 30 Days</a>
|
||||
<a id="time-option-last_6_months" class="submenu-item hover:bg-gray-800 rounded p-1 text-right w-full text-gray-300 px-2 font-semibold text-sm" :href="intervalLink('last_6_months')" @click="state.showDropdownTimepicker = !state.showDropdownTimepicker" data-trigger-for="showDropdownTimepicker">Past 6 Months</a>
|
||||
<a id="time-option-last_12_months" class="submenu-item hover:bg-gray-800 rounded p-1 text-right w-full text-gray-300 px-2 font-semibold text-sm" :href="intervalLink('last_12_months')" @click="state.showDropdownTimepicker = !state.showDropdownTimepicker" data-trigger-for="showDropdownTimepicker">Past 12 Months</a>
|
||||
<a id="time-option-any" class="submenu-item hover:bg-gray-800 rounded p-1 text-right w-full text-gray-300 px-2 font-semibold text-sm" :href="intervalLink('any')" @click="state.showDropdownTimepicker = !state.showDropdownTimepicker" data-trigger-for="showDropdownTimepicker">All Time</a>
|
||||
<hr class="my-2">
|
||||
|
Loading…
Reference in New Issue
Block a user