cpfair / tapiriik

tapiriik keeps your fitness in sync
https://tapiriik.com
Apache License 2.0
1.72k stars 294 forks source link

Only the latest activity is imported from Garmin Connect to Dropbox on the same day #354

Open c5ef2 opened 7 years ago

c5ef2 commented 7 years ago

Only the latest activity is imported from Garmin Connect to Dropbox when having multiple same category activities on the same day.

Example: I had two cycling activities on July 4th, one in the morning and the other in the evening. Only the evening's activity was imported to Dropbox (2017-07-04_Pikkala Cycling_Cycling.tcx)

The issue appeared few weeks ago and probably is caused by this commit

dbcl.files_upload(data.encode("UTF-8"), fpath, mode=dropbox.files.WriteMode.overwrite)

dropbox.files.WriteMode.overwrite mode is used for uploading activity files and that seems to be the root cause.

Better and backwards compatible solution for uploading files would be to use dropbox.files.WriteMode.add mode with autorename=True option. files_upload function code

With those options, it would generate files like it used to do before the API upgrade commit:

mennomenno commented 7 years ago

Ditto for the export of TCX files from sporttracks.mobi

RailsGuy commented 7 years ago

AHH explains my missing data

web2wire commented 6 years ago

I'm getting this quite a bit now that I've started commuting on the bike again. The morning ride is being overwritten by the evening one.

SigTill commented 6 years ago

Merge this with issue 369 : https://github.com/cpfair/tapiriik/issues/369

christofferholmstedt commented 6 years ago

In the linked issue #369 I wrote a short workaround: Press "reconfigure" in dropbox tab then "setup" and change file format to something like this (include hours and minutes):

/<YYYY>/<YYYY><MM><DD>T<HH><MIN>_<NAME>_<TYPE>

I will see if I can create a pull request later this week to update the default filename settings to this instead.

@c5ef2 Do you think this change would be good enough?

SigTill commented 6 years ago

Thank you @christofferholmstedt - I didnt think about that "workaround", trying it now. FYI i just got approved the pull request - so hopefully it will be the default soon: https://github.com/cpfair/tapiriik/pull/434

christofferholmstedt commented 6 years ago

@SigTill aha, thanks for the link to the PR.

c5ef2 commented 6 years ago

@christofferholmstedt The fix looks good. Both of my today's cycling workouts were synced correctly after I had changed my Dropbox configuration as you suggested.