diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 45cfd3d4..f99a9468 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -555,6 +555,71 @@ def fetchcp(rower,theworkouts,table='cpdata'): return [],[],avgpower2 +# create a new workout from manually entered data +def create_row_df(r,distance,duration,startdatetime, + title = 'Manually added workout',notes='', + workouttype='rower'): + + + nr_strokes = int(distance/10.) + + unixstarttime = arrow.get(startdatetime).timestamp + + totalseconds = duration.hour*3600. + totalseconds += duration.minute*60. + totalseconds += duration.second + totalseconds += duration.microsecond/1.e6 + + + spm = 60.*nr_strokes/totalseconds + + step = totalseconds/float(nr_strokes) + + elapsed = np.arange(0,totalseconds+step,step) + + dstep = distance/float(nr_strokes) + + d = np.arange(0,distance+dstep,dstep) + + unixtime = unixstarttime + elapsed + + pace = 500.*totalseconds/distance + + if workouttype in ['rower','slides','dynamic']: + velo = distance/totalseconds + power = 2.8*velo**3 + else: + power = 0 + + df = pd.DataFrame({ + 'TimeStamp (sec)': unixtime, + ' Horizontal (meters)': d, + ' Cadence (stokes/min)': spm, + ' Stroke500mPace (sec/500m)':pace, + ' ElapsedTime (sec)':elapsed, + ' Power (watts)':power, + }) + + timestr = strftime("%Y%m%d-%H%M%S") + + csvfilename = 'media/df_' + timestr + '.csv' + df[' ElapsedTime (sec)'] = df['TimeStamp (sec)'] + + row = rrdata(df=df) + + row.write_csv(csvfilename, gzip = True) + + id, message = save_workout_database(csvfilename, r, + title=title, + notes=notes, + dosmooth=False, + workouttype=workouttype, + consistencychecks=False, + totaltime=totalseconds) + + return (id, message) + + # Processes painsled CSV file to database diff --git a/rowers/templates/manualadd.html b/rowers/templates/manualadd.html new file mode 100644 index 00000000..60540df9 --- /dev/null +++ b/rowers/templates/manualadd.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} +{% load staticfiles %} +{% load rowerfilters %} +{% load tz %} + + +{% get_current_timezone as TIME_ZONE %} + +{% block content %} +
+ Please correct the error{{ form.errors|pluralize }} below. +
+ {% endif %} + + ++ +
The table gives the best efforts achieved on the official Concept2 ranking pieces in the selected date range.
-This page will evolve and try to give you guidance on where to improve.
+Use this form to select a different date range:
@@ -138,6 +138,19 @@No ranking workouts found
{% endif %} +Missing your best pieces? Upload stroke data of any Concept2 + ranking piece and they will be automatically added to this page.
+Don't have stroke data for official Concept2 ranking pieces? + The PRO membership ranking piece functionality + allows you to include your best non ranking pieces and even use + parts of workouts for improved calculation accuracy. +
+ +Want to add race results but you don't have stroke data? + Click here.
+ +Scroll down for the chart and pace predictions for ranking pieces.
+