using rowingdata_pl, requires rowingdata > 3.6.6
This commit is contained in:
@@ -73,6 +73,7 @@ import pytz
|
||||
import collections
|
||||
import pendulum
|
||||
from rowingdata import rowingdata as rrdata
|
||||
from rowingdata import rowingdata_pl as rrdata_pl
|
||||
|
||||
from rowingdata import rower as rrower
|
||||
|
||||
@@ -618,6 +619,8 @@ def update_wps(r, types, mode='water', asynchron=True):
|
||||
r.save()
|
||||
except ValueError: # pragma: no cover
|
||||
pass
|
||||
except OverflowError:
|
||||
pass
|
||||
|
||||
return True
|
||||
|
||||
@@ -1397,6 +1400,11 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
w.team.add(t)
|
||||
|
||||
# put stroke data in database
|
||||
try:
|
||||
row = rrdata_pl(df=pl.from_pandas(row.df))
|
||||
except:
|
||||
pass
|
||||
|
||||
_ = dataplep(row.df, id=w.id, bands=True,
|
||||
barchart=True, otwpower=True, empower=True, inboard=inboard)
|
||||
|
||||
|
||||
@@ -1982,6 +1982,9 @@ def dataplep(rowdatadf, id=0, inboard=0.88, forceunit='lbs', bands=True, barchar
|
||||
empower=True, debug=False, polars=True
|
||||
):
|
||||
# rowdatadf is pd.DataFrame
|
||||
|
||||
|
||||
if isinstance(rowdatadf, pd.DataFrame):
|
||||
if rowdatadf.empty:
|
||||
return 0
|
||||
|
||||
@@ -1999,6 +2002,10 @@ def dataplep(rowdatadf, id=0, inboard=0.88, forceunit='lbs', bands=True, barchar
|
||||
return dataprep(rowdatadf, id=id, inboard=inboard, forceunit=forceunit, bands=bands, barchart=barchart,
|
||||
otwpower=otwpower, debug=debug,polars=True)
|
||||
|
||||
else:
|
||||
df = rowdatadf
|
||||
if df.is_empty():
|
||||
return 0
|
||||
|
||||
df = df.with_columns((pl.col("TimeStamp (sec)")-df[0, "TimeStamp (sec)"]).alias("TimeStamp (sec)"))
|
||||
df = df.with_columns((pl.col(" Stroke500mPace (sec/500m)").clip(1,3000)).alias(" Stroke500mPace"))
|
||||
|
||||
@@ -289,31 +289,6 @@
|
||||
<label for="group-advanced">Advanced</label>
|
||||
<ul>
|
||||
{% if workout|water %}
|
||||
<li id="advanced-wind">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/wind/">
|
||||
<i class="fas fa-pennant fa-fw"></i> Wind
|
||||
</a>
|
||||
</li>
|
||||
<li id="advanced-stream">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/stream/">
|
||||
<i class="fas fa-stream fa-fw"></i> Stream
|
||||
</a>
|
||||
</li>
|
||||
<li id="chart-otwpower">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/interactiveotwplot/">
|
||||
<i class="fal fa-calculator-alt fa-fw"></i> Corrected Pace Plot
|
||||
</a>
|
||||
</li>
|
||||
<li id="advanced-otwpower">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/otwsetpower/">
|
||||
<i class="fas fa-calculator-alt fa-fw"></i> OTW Power
|
||||
</a>
|
||||
</li>
|
||||
<li id="advanced-otwpower">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/zeropower-confirm/">
|
||||
<i class="fas fa-eraser fa-fw"></i> Remove Power Data
|
||||
</a>
|
||||
</li>
|
||||
{% if 'speedcoach2' in workout.workoutsource or 'nklinklogbook' in workout.workoutsource %}
|
||||
<li id="advanced-usegps">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/otwusegps/">
|
||||
|
||||
@@ -13,6 +13,7 @@ from django.db import transaction
|
||||
nu = datetime.datetime.now()
|
||||
import datetime
|
||||
import pytz
|
||||
import polars as pl
|
||||
|
||||
# interactive plots
|
||||
from rowers import interactiveplots
|
||||
@@ -659,7 +660,7 @@ class InteractivePlotTests(TestCase):
|
||||
pass
|
||||
|
||||
def test_interactive_hr_piechart(self):
|
||||
df = pd.read_csv('rowers/tests/testdata/getrowdata_mock.csv')
|
||||
df = pl.read_csv('rowers/tests/testdata/getrowdata_mock.csv')
|
||||
|
||||
script, div = interactiveplots.interactive_hr_piechart(df, self.r,'')
|
||||
self.assertFalse(len(script)==0)
|
||||
|
||||
@@ -157,17 +157,14 @@ class URLTests(TestCase):
|
||||
'/rowers/workout/'+encoded1+'/instroke/',
|
||||
'/rowers/workout/'+encoded1+'/interactiveotwplot/',
|
||||
'/rowers/workout/'+encoded1+'/map/',
|
||||
'/rowers/workout/'+encoded1+'/otwsetpower/',
|
||||
'/rowers/workout/'+encoded1+'/recalcsummary/',
|
||||
'/rowers/workout/'+encoded1+'/restore/',
|
||||
'/rowers/workout/'+encoded1+'/smoothenpace/',
|
||||
'/rowers/workout/'+encoded1+'/split/',
|
||||
'/rowers/workout/'+encoded1+'/stats/',
|
||||
'/rowers/workout/'+encoded1+'/stream/',
|
||||
'/rowers/workout/'+encoded1+'/undosmoothenpace/',
|
||||
'/rowers/workout/'+encoded1+'/unsubscribe/',
|
||||
'/rowers/workout/'+encoded1+'/view/',
|
||||
'/rowers/workout/'+encoded1+'/wind/',
|
||||
'/rowers/workout/'+encoded1+'/workflow/',
|
||||
'/rowers/workout/fusion/'+encoded1+'/',
|
||||
'/rowers/workout/upload/',
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user