Skip to content

Commit

Permalink
run golines
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoisaiah committed Dec 1, 2023
1 parent 4fb3fe6 commit 9c06289
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 11 additions & 4 deletions stats/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ type (
//go:embed web/*
var web embed.FS

var tpl = template.Must(template.New("index.html").ParseFS(web, "web/index.html"))
var tpl = template.Must(
template.New("index.html").ParseFS(web, "web/index.html"),
)

func (h errorHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
err := h(w, r)
Expand All @@ -39,7 +41,10 @@ func (h errorHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
}

func (s *Stats) getStats(startTime, endTime time.Time, tagList []string) ([]byte, error) {
func (s *Stats) getStats(
startTime, endTime time.Time,
tagList []string,
) ([]byte, error) {
s.Opts.StartTime = startTime
s.Opts.EndTime = endTime
s.Opts.Tags = tagList
Expand Down Expand Up @@ -94,8 +99,10 @@ func (s *Stats) index(w http.ResponseWriter, r *http.Request) error {
err = tpl.Execute(&buf, &TemplateData{
StartTime: startTime.Format(time.RFC3339Nano),
EndTime: endTime.Format(time.RFC3339Nano),
Days: int(math.Round(endTime.Sub(startTime).Seconds() / (24 * 60 * 60))),
Stats: string(b),
Days: int(
math.Round(endTime.Sub(startTime).Seconds() / (24 * 60 * 60)),
),
Stats: string(b),
})
if err != nil {
return err
Expand Down
6 changes: 5 additions & 1 deletion timer/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ func (s *Session) Normalise(c context.Context) {
time.Duration(secondsLeft * float64(time.Second)),
)

slog.InfoContext(c, "normalizing completed session end time", slog.Time("end_time", end))
slog.InfoContext(
c,
"normalizing completed session end time",
slog.Time("end_time", end),
)

s.Timeline[lastIndex].EndTime = end
s.EndTime = end
Expand Down

0 comments on commit 9c06289

Please sign in to comment.