Merge branch 'release/v13.57'
This commit is contained in:
+1
-1
@@ -758,7 +758,7 @@ def getpartofday(row,r):
|
||||
tf = TimezoneFinder()
|
||||
try:
|
||||
timezone_str = tf.timezone_at(lng=lonavg, lat=latavg)
|
||||
except ValueError:
|
||||
except (ValueError,OverflowError):
|
||||
timezone_str = 'UTC'
|
||||
if timezone_str == None:
|
||||
timezone_str = tf.closest_timezone_at(lng=lonavg,
|
||||
|
||||
@@ -353,7 +353,10 @@ def create_async_workout(alldata,user,stravaid,debug=False):
|
||||
from rowers.utils import get_strava_stream
|
||||
|
||||
def async_get_workout(user,stravaid):
|
||||
token = strava_open(user)
|
||||
try:
|
||||
token = strava_open(user)
|
||||
except NoTokenError:
|
||||
return 0
|
||||
csvfilename = 'media/{code}_{stravaid}.csv'.format(code=uuid4().hex[:16],stravaid=stravaid)
|
||||
job = myqueue(queue,
|
||||
fetch_strava_workout,
|
||||
|
||||
+9
-1
@@ -697,6 +697,13 @@ def handle_get_garmin_file(client_id,
|
||||
**kwargs):
|
||||
|
||||
|
||||
regex = '.*\?id=(\d+)'
|
||||
try:
|
||||
m = re.compile(regex).match(url).group(1)
|
||||
garminid = int(m)
|
||||
except AttributeError:
|
||||
garminid = ''
|
||||
|
||||
|
||||
garmin = OAuth1Session(client_id,
|
||||
client_secret=client_secret,
|
||||
@@ -724,6 +731,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 +2977,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))
|
||||
|
||||
|
||||
|
||||
@@ -534,6 +534,16 @@ def do_sync(w,options, quick=False):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
try:
|
||||
if options['garminid'] != 0 and options['garminid'] != '':
|
||||
w.uploadedtogarmin = options['garminid']
|
||||
w.save()
|
||||
except KeyError:
|
||||
print('keyerror')
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
if ('upload_to_C2' in options and options['upload_to_C2']) or (w.user.c2_auto_export):
|
||||
try:
|
||||
|
||||
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user