Private
Public Access
1
0

Merge branch 'release/13.75' into master

This commit is contained in:
Sander Roosendaal
2020-08-20 16:51:09 +02:00
5 changed files with 22 additions and 6 deletions
+1 -1
View File
@@ -184,7 +184,7 @@ ratelim==0.1.6
redis==3.2.1 redis==3.2.1
requests==2.23.0 requests==2.23.0
requests-oauthlib==1.2.0 requests-oauthlib==1.2.0
rowingdata==2.9.1 rowingdata==2.9.3
rowingphysics==0.5.0 rowingphysics==0.5.0
rq==0.13.0 rq==0.13.0
rules==2.1 rules==2.1
+2 -1
View File
@@ -31,6 +31,7 @@ import dask.dataframe as dd
from dask.delayed import delayed from dask.delayed import delayed
import pyarrow.parquet as pq import pyarrow.parquet as pq
import pyarrow as pa import pyarrow as pa
from pyarrow.lib import ArrowInvalid from pyarrow.lib import ArrowInvalid
from django.utils import timezone from django.utils import timezone
@@ -2379,7 +2380,7 @@ def read_df_sql(id):
try: try:
f = 'media/strokedata_{id}.parquet.gz'.format(id=id) f = 'media/strokedata_{id}.parquet.gz'.format(id=id)
df = pd.read_parquet(f) df = pd.read_parquet(f)
except OSError: except (OSError,ArrowInvalid):
rowdata,row = getrowdata(id=id) rowdata,row = getrowdata(id=id)
if rowdata and len(rowdata.df): if rowdata and len(rowdata.df):
data = dataprep(rowdata.df,id=id,bands=True,otwpower=True,barchart=True) data = dataprep(rowdata.df,id=id,bands=True,otwpower=True,barchart=True)
+2 -2
View File
@@ -1531,7 +1531,7 @@ def add_workout_indoorrace(ws,race,r,recordid=0,doregister=False):
errors.append('You must submit a indoor rowing workout') errors.append('You must submit a indoor rowing workout')
return 0,comments, errors, 0 return 0,comments, errors, 0
if ws[0].weightcategory != record.weightcategory: if record.weightcategory == 'lwt' and ws[0].weightcategory != record.weightcategory:
errors.append('Your workout weight category did not match the weight category you registered') errors.append('Your workout weight category did not match the weight category you registered')
return 0,comments, errors,0 return 0,comments, errors,0
@@ -1671,7 +1671,7 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0,doregister=False):
errors.append('Your workout boat type did not match the boat type you registered') errors.append('Your workout boat type did not match the boat type you registered')
return 0,comments,errors,0 return 0,comments,errors,0
if ws[0].weightcategory != record.weightcategory: if record.weightcategory == 'lwt' and ws[0].weightcategory != record.weightcategory:
errors.append('Your workout weight category did not match the weight category you registered') errors.append('Your workout weight category did not match the weight category you registered')
return 0,comments, errors,0 return 0,comments, errors,0
+16 -1
View File
@@ -7,6 +7,8 @@ from __future__ import unicode_literals, absolute_import
# All the functionality needed to connect to Strava # All the functionality needed to connect to Strava
from scipy import optimize from scipy import optimize
from scipy.signal import savgol_filter from scipy.signal import savgol_filter
import time
from time import strftime
from django_mailbox.models import Message,Mailbox,MessageAttachment from django_mailbox.models import Message,Mailbox,MessageAttachment
@@ -75,6 +77,19 @@ def get_token(code):
return imports_get_token(code, oauth_data) return imports_get_token(code, oauth_data)
def strava_open(user): def strava_open(user):
t = time.localtime()
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
with open('strava_webhooks.log','a') as f:
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write('Getting token for user ')
f.write(str(user.rower.id))
f.write(' token expiry ')
f.write(str(user.rower.stravatokenexpirydate))
f.write(' ')
f.write(json.dumps(oauth_data))
f.write('\n')
token = imports_open(user, oauth_data) token = imports_open(user, oauth_data)
if user.rower.strava_owner_id == 0: if user.rower.strava_owner_id == 0:
strava_owner_id = set_strava_athlete_id(user) strava_owner_id = set_strava_athlete_id(user)
@@ -357,7 +372,7 @@ def async_get_workout(user,stravaid):
token = strava_open(user) token = strava_open(user)
except NoTokenError: except NoTokenError:
return 0 return 0
csvfilename = 'media/{code}_{stravaid}.csv'.format(code=uuid4().hex[:16],stravaid=stravaid) csvfilename = 'media/{code}_{stravaid}.csv'.format(code=uuid4().hex[:16],stravaid=stravaid)
job = myqueue(queue, job = myqueue(queue,
fetch_strava_workout, fetch_strava_workout,
+1 -1
View File
@@ -2739,7 +2739,7 @@ def fetch_strava_workout(stravatoken,oauth_data,stravaid,csvfilename,userid,debu
f.write('\n') f.write('\n')
f.write(timestamp) f.write(timestamp)
f.write(' ') f.write(' ')
f.write('handle_get_garmin_file response code {code}\n'.format(code=response.status_code)) f.write('handle_get_strava_file response code {code}\n'.format(code=response.status_code))
f.write('Response json {json}\n'.format(json=response.json())) f.write('Response json {json}\n'.format(json=response.json()))
return 0 return 0