Skip to content

Commit

Permalink
fix: pass in trimmed strava activities
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Gleich <[email protected]>
  • Loading branch information
gleich committed Aug 19, 2024
1 parent 31326d7 commit 3c53e2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/apis/strava/activities.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func fetchActivities(minioClient minio.Client, tokens tokens) ([]activity, error
}
activities = append(activities, a)
}
removeOldMaps(minioClient, stravaActivities)
removeOldMaps(minioClient, activities)

return activities, nil
}
Expand Down
6 changes: 3 additions & 3 deletions internal/apis/strava/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"image/png"
"net/http"
"net/url"
"strings"

"github.com/buckket/go-blurhash"
"github.com/gleich/lcp-v2/internal/secrets"
Expand Down Expand Up @@ -101,7 +100,7 @@ func uploadMap(minioClient minio.Client, id uint64, data []byte) {
}
}

func removeOldMaps(minioClient minio.Client, activities []stravaActivity) {
func removeOldMaps(minioClient minio.Client, activities []activity) {
var validKeys []string
for _, activity := range activities {
validKeys = append(validKeys, fmt.Sprintf("%d.png", activity.ID))
Expand All @@ -115,8 +114,9 @@ func removeOldMaps(minioClient minio.Client, activities []stravaActivity) {
}
var validObject bool
for _, validKey := range validKeys {
if strings.Contains(object.Key, validKey) {
if validKey == object.Key {
validObject = true
break
}
}
if !validObject {
Expand Down

0 comments on commit 3c53e2e

Please sign in to comment.