fix(dashboard): #163 month selection on first load
This commit was merged in pull request #183.
This commit is contained in:
@@ -22,12 +22,14 @@ type Index interface {
|
||||
type IndexImpl struct {
|
||||
r *Render
|
||||
d *service.Dashboard
|
||||
c service.Clock
|
||||
}
|
||||
|
||||
func NewIndex(r *Render, d *service.Dashboard) Index {
|
||||
func NewIndex(r *Render, d *service.Dashboard, c service.Clock) Index {
|
||||
return IndexImpl{
|
||||
r: r,
|
||||
d: d,
|
||||
c: c,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +83,7 @@ func (handler IndexImpl) dashboard(user *types.User, htmx bool, r *http.Request)
|
||||
return nil, fmt.Errorf("could not parse timestamp: %w", service.ErrBadRequest)
|
||||
}
|
||||
} else {
|
||||
month = time.Now()
|
||||
month = handler.c.Now()
|
||||
}
|
||||
|
||||
summary, err := handler.d.Summary(r.Context(), user, month)
|
||||
|
||||
Reference in New Issue
Block a user