1
0
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:
Konstantin Kondr 2021-09-07 10:12:24 +00:00
parent 1ab29b22e1
commit a869897f80

View File

@ -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("/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
@ -61,7 +62,7 @@ func (h *StatusBarHandler) Get(w http.ResponseWriter, r *http.Request) {
rangeParam := vars["range"]
if rangeParam == "" {
rangeParam = (*models.IntervalPast7Days)[0]
rangeParam = (*models.IntervalToday)[0]
}
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) {
summaryParams := &models.SummaryParams{
From: time.Time{},
To: time.Now(),
From: start,
To: end,
User: user,
Recompute: false,
}