thomaschampagne / elevate

A sport app to "Elevate" your training experience and goals! Track your fitness and progressions over time. Analyse deeper your activities. And more...
https://thomaschampagne.github.io/elevate-docs/
Mozilla Public License 2.0
1.28k stars 176 forks source link

[Web-Ext][Bug] Initial sync unable to load more than 3000 activities #1205

Open bartvanandel opened 2 weeks ago

bartvanandel commented 2 weeks ago

Describe the bug My Strava profile has more than 3000 activities. During the initial sync, briefly it shows the (correct) total number of activities. However, during sync, this immediately changes to 3000 activities.

I am pretty sure this is caused by using the non-API URL used (e.g., https://www.strava.com/athlete/training_activities?new_activity_only=false&per_page=20&page=114), which also on the Strava website limits the amount of history that can be shown. That endpoint will return total: 3000 in the response as the max value, and consequetly won't go beyond page 150. Page 151 will just return an empty result set.

This is likely resolved by using the appropriate API equivalent, getLoggedInAthleteActivities, which also allows loading more than 20 activities per page (default is 30, the documentation doesn't mention the upper limit).

I think using this endpoint can also be used to speed up the initial load (or forced full sync) a lot by keeping track of the progress of the import process, so continuing the import doesn't need to load all previous "list activities" queries again. For context, my initial import took about 2 weeks currently, which is very suboptimal, to put it mildly.

To Reproduce Steps to reproduce the behavior:

  1. Have more than 3000 activities on Strava
  2. Open https://www.strava.com/dashboard?elevateSync=true&fastSync=false&forceSync=false
  3. Keep an eye out for the "Total activities found". It will display the correct value briefly, then jump down to 3000.

Expected behavior All activities are loaded, not just the most recent 3000.

Environment

MisterTickle commented 2 weeks ago

I think it's a very good suggestion. For my first load it took me many days, because it kept telling me to wait 4-6 hours between attempts to get the next "chunk" of my Strava data. Each subsequent time, the first 10 minutes is taken up by fetching activity groups to painfully arrive at the first "new" one that should be imported. Next, a few precious minutes of importing new data, before Strava quickly slams the door shut again because I've made too many requests.

But 2/3rd of those requests each time are the "finding out where to resume from" part.

By the way, there are some helpful messages logged in the browser Console if anything flies past too quickly.