diff --git a/rowers/celery.py b/rowers/celery.py index a9865a5d..8ecc91a9 100644 --- a/rowers/celery.py +++ b/rowers/celery.py @@ -3,6 +3,7 @@ from __future__ import absolute_import import os from celery import Celery +from celery import result # Only used for testing with Celery on localhost. RQ is not available # on Windows, so I use Celery on my notebook. @@ -17,6 +18,7 @@ app = Celery('tasks', broker='redis://localhost', backend='redis://localhost',) + class Config: CELERY_TIMEZONE = 'Europe/Prague' @@ -31,3 +33,4 @@ database_url = 'sqlite:///db.sqlite3' @app.task(bind=True) def debug_task(self): print('Request: {0!r}'.format(self.request)) + diff --git a/rowers/dataprep.py b/rowers/dataprep.py index c604b265..8799f25c 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -473,9 +473,11 @@ def updatecpdata_sql(rower_id,delta,cp,table='cpdata',distance=[]): engine.dispose() -def runcpupdate(rower,type='water'): - startdate = timezone.now()-datetime.timedelta(days=365) - enddate = timezone.now()+datetime.timedelta(days=5) +def runcpupdate( + rower,type='water', + startdate=timezone.now()-datetime.timedelta(days=365), + enddate=timezone.now()+datetime.timedelta(days=5) +): if type == 'water': theworkouts = Workout.objects.filter( user=rower,rankingpiece=True, @@ -499,11 +501,12 @@ def runcpupdate(rower,type='water'): theids = [w.id for w in theworkouts] - if settings.DEBUG: - res = handle_updatecp.delay(rower.id,theids,debug=True,table=table) + job = handle_updatecp.delay(rower.id,theids,debug=True,table=table) else: - res = queue.enqueue(handle_updatecp,rower.id,theids,table=table) + job = queue.enqueue(handle_updatecp,rower.id,theids,table=table) + + return job def fetchcperg(rower,theworkouts): theids = [int(w.id) for w in theworkouts] diff --git a/rowers/models.py b/rowers/models.py index bfc190cc..ef3d25e0 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -263,6 +263,15 @@ class Rower(models.Model): p2 = models.FloatField(default=1.0,verbose_name="CP p3") p3 = models.FloatField(default=1.0,verbose_name="CP p4") cpratio = models.FloatField(default=1.0,verbose_name="CP fit ratio") + + + ep0 = models.FloatField(default=1.0,verbose_name="erg CP p1") + ep1 = models.FloatField(default=1.0,verbose_name="erg CP p2") + ep2 = models.FloatField(default=1.0,verbose_name="erg CP p3") + ep3 = models.FloatField(default=1.0,verbose_name="erg CP p4") + ecpratio = models.FloatField(default=1.0,verbose_name="erg CP fit ratio") + + otwslack = models.IntegerField(default=0,verbose_name="OTW Power slack") diff --git a/rowers/templates/otwrankings.html b/rowers/templates/otwrankings.html index d31eed1c..35c6069d 100644 --- a/rowers/templates/otwrankings.html +++ b/rowers/templates/otwrankings.html @@ -50,7 +50,11 @@
Direct link for other users: - https://rowsandall.com/rowers/{{ id }}/otw-bests/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }} + {% if workouttype == 'water' %} + https://rowsandall.com/rowers/{{ id }}/otw-bests/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }} + {% else %} + https://rowsandall.com/rowers/{{ id }}/ote-ranking/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }} + {% endif %}
-The table gives the OTW efforts you marked as Ranking Piece. +
The table gives the efforts you marked as Ranking Piece. The graph shows the best segments from those pieces, plotted as average power (over the segment) vs the duration of the segment/ In other words: How long you can hold that power.
+ +When you change the date range, the algorithm calculates new + parameters in a background process. You may have to reload the + page to get an updated prediction.
At the bottom of the page, you will find predictions derived from the model.
+ Workflow View +
+ {% else %} ++ {% endif %} +
Delete Chart diff --git a/rowers/templates/workflowconfig2.html b/rowers/templates/workflowconfig2.html index 86b1e7f5..abdfe052 100644 --- a/rowers/templates/workflowconfig2.html +++ b/rowers/templates/workflowconfig2.html @@ -21,7 +21,7 @@
On this page, you can configure the content of your "Workflow" page for each workout. If you want to remove an element, change it to "None". You can add one new element at a time.
-Default landing page is Edit View. Set default landing page to
+ Workflow View + {% else %} +Default landing page is Workflow View. Set default landing page to
+ Edit View + {% endif %} +