Merge branch 'release/v10.43'
This commit is contained in:
@@ -574,6 +574,7 @@ def createc2workoutdata(w):
|
||||
"time": int(10*makeseconds(durationstr)),
|
||||
"weight_class": c2wc(w.weightcategory),
|
||||
"comments": w.notes,
|
||||
"stroke_count": int(row.stroke_count),
|
||||
'stroke_rate': int(row.df[' Cadence (stokes/min)'].mean()),
|
||||
'drag_factor': int(row.dragfactor),
|
||||
"heart_rate": {
|
||||
|
||||
@@ -2007,9 +2007,9 @@ def read_df_sql(id):
|
||||
f = 'media/strokedata_{id}.parquet.gz'.format(id=id)
|
||||
df = pd.read_parquet(f)
|
||||
except OSError:
|
||||
rowdata,row = getrowdata(id=ids[0])
|
||||
rowdata,row = getrowdata(id=id)
|
||||
if rowdata and len(rowdata.df):
|
||||
data = dataprep(rowdata.df,id=ids[0],bands=True,otwpower=True,barchart=True)
|
||||
data = dataprep(rowdata.df,id=id,bands=True,otwpower=True,barchart=True)
|
||||
df = pd.read_parquet(f)
|
||||
|
||||
df = df.fillna(value=0)
|
||||
|
||||
@@ -166,7 +166,7 @@ def create_c2_stroke_data_db(
|
||||
try:
|
||||
spm = 60.*nr_strokes/totalseconds
|
||||
except ZeroDivisionError:
|
||||
spm = 20*zeros(nr_strokes)
|
||||
spm = 20*np.zeros(nr_strokes)
|
||||
|
||||
step = totalseconds/float(nr_strokes)
|
||||
|
||||
@@ -713,7 +713,7 @@ def getsmallrowdata_db(columns,ids=[],debug=False):
|
||||
columns = [c for c in columns if c != 'None']
|
||||
|
||||
if len(ids)>1:
|
||||
for f in csvfilenames:
|
||||
for id, f in zip(ids,csvfilenames):
|
||||
try:
|
||||
df = pd.read_parquet(f,columns=columns,engine='pyarrow')
|
||||
data.append(df)
|
||||
@@ -721,7 +721,10 @@ def getsmallrowdata_db(columns,ids=[],debug=False):
|
||||
pass
|
||||
|
||||
|
||||
df = pd.concat(data,axis=0)
|
||||
try:
|
||||
df = pd.concat(data,axis=0)
|
||||
except ValueError:
|
||||
df = pd.DataFrame()
|
||||
else:
|
||||
df = pd.read_parquet(csvfilenames[0],columns=columns,engine='pyarrow')
|
||||
|
||||
|
||||
@@ -130,8 +130,8 @@ def handle_c2_import_stroke_data(c2token,
|
||||
|
||||
authorizationstring = str('Bearer ' + c2token)
|
||||
headers = {'Authorization': authorizationstring,
|
||||
'user-agent': 'sanderroosendaal',
|
||||
'Content-Type': 'application/json'}
|
||||
'user-agent': 'sanderroosendaal',
|
||||
'Content-Type': 'application/json'}
|
||||
url = "https://log.concept2.com/api/users/me/results/"+str(c2id)+"/strokes"
|
||||
s = requests.get(url,headers=headers)
|
||||
if s.status_code == 200:
|
||||
@@ -191,7 +191,10 @@ def getagegrouprecord(age,sex='male',weightcategory='hwt',
|
||||
distance=2000,duration=None,indf=pd.DataFrame()):
|
||||
|
||||
if not duration:
|
||||
df = indf[indf['distance'] == distance]
|
||||
try:
|
||||
df = indf[indf['distance'] == distance]
|
||||
except KeyError:
|
||||
df = pd.DataFrame()
|
||||
else:
|
||||
duration = 60*int(duration)
|
||||
df = indf[indf['duration'] == duration]
|
||||
|
||||
Reference in New Issue
Block a user