diff --git a/rowers/dataroutines.py b/rowers/dataroutines.py index d34a1a3e..a47521d5 100644 --- a/rowers/dataroutines.py +++ b/rowers/dataroutines.py @@ -1648,10 +1648,14 @@ def read_data(columns, ids=[], doclean=True, workstrokesonly=True, debug=False, datadf = pl.concat(data) existing_columns = [col for col in columns if col in datadf.columns] datadf = datadf.select(existing_columns) - except (ShapeError, SchemaError, ColumnNotFoundError): - data = [ - df.select(columns) - for df in data] + except (ShapeError, SchemaError): + try: + data = [ + df.select(columns) + for df in data] + except ColumnNotFoundError: + existing_columns = [col for col in columns if col in df.columns] + df = df.select(existing_columns) # float columns floatcolumns = [] @@ -1686,14 +1690,19 @@ def read_data(columns, ids=[], doclean=True, workstrokesonly=True, debug=False, ] except ComputeError: pass + except ColumnNotFoundError: + pass try: datadf = pl.concat(data) except SchemaError: - data = [ - df.with_columns(cs.integer().cast(pl.Float64)) for df in data - ] - datadf = pl.concat(data) + try: + data = [ + df.with_columns(cs.integer().cast(pl.Float64)) for df in data + ] + datadf = pl.concat(data) + except ShapeError: + return pl.DataFrame() diff --git a/rowers/integrations/intervals.py b/rowers/integrations/intervals.py index eac69c03..ce3ae480 100644 --- a/rowers/integrations/intervals.py +++ b/rowers/integrations/intervals.py @@ -18,6 +18,7 @@ from uuid import uuid4 from django.utils import timezone from datetime import timedelta import rowers.dataprep as dataprep +from rowers.opaque import encoder from rowsandall_app.settings import ( INTERVALS_CLIENT_ID, INTERVALS_REDIRECT_URI, INTERVALS_CLIENT_SECRET, SITE_URL @@ -171,6 +172,7 @@ class IntervalsIntegration(SyncIntegration): params = { 'name': workout.name, 'description': workout.notes, + 'external_id': encoder.encode_hex(workout.id), } diff --git a/rowers/integrations/trainingpeaks.py b/rowers/integrations/trainingpeaks.py index 8dbefd35..93a73089 100644 --- a/rowers/integrations/trainingpeaks.py +++ b/rowers/integrations/trainingpeaks.py @@ -67,7 +67,10 @@ class TPIntegration(SyncIntegration): except TypeError: newnotes = 'from '+w.workoutsource+' via rowsandall.com' - row.exporttotcx(tcxfilename, notes=newnotes, sport=tpmapping[w.workouttype]) + try: + row.exporttotcx(tcxfilename, notes=newnotes, sport=tpmapping[w.workouttype]) + except KeyError: + row.exporttotcx(tcxfilename, notes=newnotes, sport='other') return tcxfilename diff --git a/rowers/tasks.py b/rowers/tasks.py index b8ab9014..6dc30f32 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -3741,7 +3741,8 @@ def handle_c2_async_workout(alldata, userid, c2token, c2id, delaysec, code=uuid4().hex[:16], c2id=c2id) startdatetime, starttime, workoutdate, duration, starttimeunix, timezone = utils.get_startdatetime_from_c2data( - data) + data + ) s = 'Time zone {timezone}, startdatetime {startdatetime}, duration {duration}'.format( timezone=timezone, startdatetime=startdatetime, @@ -3801,6 +3802,7 @@ def handle_c2_async_workout(alldata, userid, c2token, c2id, delaysec, strokelength = np.zeros(nr_rows) dist2 = 0.1*strokedata.loc[:, 'd'] + cumdist, intervals = make_cumvalues(dist2) try: spm = strokedata.loc[:, 'spm'] @@ -3842,7 +3844,7 @@ def handle_c2_async_workout(alldata, userid, c2token, c2id, delaysec, ' lapIdx': lapidx, ' WorkoutState': 4, ' ElapsedTime (sec)': seconds, - 'cum_dist': dist2 + 'cum_dist': cumdist }) df.sort_values(by='TimeStamp (sec)', ascending=True) diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz index eca15abb..7c4266ea 100644 Binary files a/rowers/tests/testdata/testdata.tcx.gz and b/rowers/tests/testdata/testdata.tcx.gz differ