fix: ensure listen activity correctly sums listen activity in step (#139)

* remove impossible nil check

* fix listen activity not correctly aggregating step

* remove stray log

* fix test
This commit is contained in:
Gabe Farrell 2026-01-14 21:35:01 -05:00 committed by GitHub
parent 3305ad269e
commit d87ed2eb97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 43 additions and 24 deletions

View file

@ -91,7 +91,9 @@ func ListenActivityOptsToTimes(opts ListenActivityOpts) (start, end time.Time) {
// Align to most recent Sunday
weekday := int(now.Weekday()) // Sunday = 0
startOfThisWeek := time.Date(now.Year(), now.Month(), now.Day()-weekday, 0, 0, 0, 0, loc)
start = startOfThisWeek.AddDate(0, 0, -7*opts.Range)
// need to subtract 1 from range for week because we are going back from the beginning of this
// week, so we sort of already went back a week
start = startOfThisWeek.AddDate(0, 0, -7*(opts.Range-1))
end = startOfThisWeek.AddDate(0, 0, 7).Add(-time.Nanosecond)
case StepMonth: