mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
statusbar endpoint fix
This commit is contained in:
parent
1ab29b22e1
commit
a869897f80
@ -41,6 +41,7 @@ func (h *StatusBarHandler) RegisterRoutes(router *mux.Router) {
|
|||||||
)
|
)
|
||||||
r.Path("/users/{user}/statusbar/{range}").Methods(http.MethodGet).HandlerFunc(h.Get)
|
r.Path("/users/{user}/statusbar/{range}").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||||
r.Path("/v1/users/{user}/statusbar/{range}").Methods(http.MethodGet).HandlerFunc(h.Get)
|
r.Path("/v1/users/{user}/statusbar/{range}").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||||
|
r.Path("/compat/wakatime/v1/users/{user}/statusbar/{range}").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Retrieve summary for statusbar
|
// @Summary Retrieve summary for statusbar
|
||||||
@ -61,7 +62,7 @@ func (h *StatusBarHandler) Get(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
rangeParam := vars["range"]
|
rangeParam := vars["range"]
|
||||||
if rangeParam == "" {
|
if rangeParam == "" {
|
||||||
rangeParam = (*models.IntervalPast7Days)[0]
|
rangeParam = (*models.IntervalToday)[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
err, rangeFrom, rangeTo := utils.ResolveIntervalRawTZ(rangeParam, user.TZ())
|
err, rangeFrom, rangeTo := utils.ResolveIntervalRawTZ(rangeParam, user.TZ())
|
||||||
@ -86,8 +87,8 @@ func (h *StatusBarHandler) Get(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func (h *StatusBarHandler) loadUserSummary(user *models.User, start, end time.Time) (*models.Summary, int, error) {
|
func (h *StatusBarHandler) loadUserSummary(user *models.User, start, end time.Time) (*models.Summary, int, error) {
|
||||||
summaryParams := &models.SummaryParams{
|
summaryParams := &models.SummaryParams{
|
||||||
From: time.Time{},
|
From: start,
|
||||||
To: time.Now(),
|
To: end,
|
||||||
User: user,
|
User: user,
|
||||||
Recompute: false,
|
Recompute: false,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user