Skip to content

Add media bonus points and auto-import Strava photos#3

Merged
prazgaitis merged 4 commits intomainfrom
claude/add-media-scoring-XkPF3
Feb 9, 2026
Merged

Add media bonus points and auto-import Strava photos#3
prazgaitis merged 4 commits intomainfrom
claude/add-media-scoring-XkPF3

Conversation

@prazgaitis
Copy link
Copy Markdown
Owner

Summary

This PR adds a +1 bonus point reward for activities that include photos or media attachments, and implements automatic photo import from Strava activities.

Changes

Media Bonus Scoring:

  • Added MEDIA_BONUS_POINTS constant and calculateMediaBonus() function to the scoring engine
  • Integrated media bonus into both manual activity logging and Strava webhook processing
  • Media bonus appears as a triggered bonus ("Photo bonus") in activity point breakdowns
  • Bonus is awarded if the activity has mediaIds, an imageUrl, or Strava photos

Strava Photo Import:

  • Updated StravaActivity interface to include the photos field from Strava's detailed activity endpoint
  • Added extractStravaPhotos() helper function to extract the highest-resolution primary photo URL
  • Added stravaPhotoUrls field to MappedActivityData to track imported photo URLs
  • Strava activities now automatically store their primary photo as imageUrl
  • Existing Strava activities are updated with photo URLs on re-sync

Technical Details

  • The Strava API returns photos with multiple resolutions in photos.primary.urls (e.g., { "100": "url", "600": "url" }). We extract the largest available resolution.
  • No database schema changes needed — imageUrl already exists on the activities table
  • Media bonus calculation is consistent across manual and Strava-imported activities

Testing

  • pnpm lint
  • pnpm typecheck
  • Manual testing: Log activity with photo and verify +1 bonus point
  • Manual testing: Sync Strava activity with photos and verify photo import and bonus

Notes

  • The media bonus is stored as a triggered bonus with metric: "media" for consistency with other bonuses
  • Photo URLs are extracted from the primary photo object; additional photos in the activity are not currently utilized

https://claude.ai/code/session_01VBqCWbawfK3FSaAb7B59Gs

Activities with at least one photo/media attachment now earn a +1
"Photo bonus" point. Strava activities with photos automatically
have their primary photo URL imported and stored as imageUrl.

https://claude.ai/code/session_01VBqCWbawfK3FSaAb7B59Gs
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
march-fitness-2025 Error Error Feb 9, 2026 3:54pm

Request Review

@prazgaitis prazgaitis marked this pull request as ready for review February 9, 2026 15:53
@prazgaitis prazgaitis merged commit ce3ae0b into main Feb 9, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants