Private
Public Access
1
0

adding garmin id

This commit is contained in:
Sander Roosendaal
2020-07-16 22:07:45 +02:00
parent b0d7952fe3
commit 4b192addf2
3 changed files with 19 additions and 1 deletions

View File

@@ -697,6 +697,9 @@ def handle_get_garmin_file(client_id,
**kwargs):
regex = '.*\?id=(\d+)'
m = re.compile(regex).match(url).group(1)
garminid = int(m)
garmin = OAuth1Session(client_id,
client_secret=client_secret,
@@ -724,6 +727,7 @@ def handle_get_garmin_file(client_id,
'title': '',
'workouttype':'water',
'boattype':'1x',
'garminid': garminid,
}
session = requests.session()
newHeaders = {'Content-type': 'application/json', 'Accept': 'text/plain'}
@@ -2969,7 +2973,7 @@ def fetch_strava_workout(stravatoken,oauth_data,stravaid,csvfilename,userid,debu
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write('handle_get_garmin_file posted file with strava id {stravaid} user id {userid}\n'.format(
f.write('fetch_strava_workout posted file with strava id {stravaid} user id {userid}\n'.format(
stravaid=stravaid,userid=userid))

View File

@@ -534,6 +534,15 @@ def do_sync(w,options, quick=False):
except KeyError:
pass
try:
if options['garmind'] != 0 and options['garminid'] != '':
w.uploadedtogarmin = options['garminid']
w.save()
except KeyError:
pass
if ('upload_to_C2' in options and options['upload_to_C2']) or (w.user.c2_auto_export):
try:

View File

@@ -4666,6 +4666,11 @@ def workout_upload_api(request):
except KeyError:
stravaid = ''
try:
garminid = post_data['garminid']
except KeyError:
garminid = 0
if form.is_valid():
t = form.cleaned_data['title']
boattype = form.cleaned_data['boattype']