diff --git a/rowers/dataprep.py b/rowers/dataprep.py index adfd720b..bbfd6ffb 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -1388,7 +1388,7 @@ def parsenonpainsled(fileformat,f2,summary): try: row = parsers[fileformat](f2) hasrecognized = True - except KeyError: + except (KeyError,IndexError): hasrecognized = False return None, hasrecognized, '', 'unknown' diff --git a/rowers/dataprepnodjango.py b/rowers/dataprepnodjango.py index 52400767..f41498fb 100644 --- a/rowers/dataprepnodjango.py +++ b/rowers/dataprepnodjango.py @@ -715,6 +715,8 @@ def getsmallrowdata_db(columns,ids=[],debug=False): data = [] columns = [c for c in columns if c != 'None'] + df = pd.DataFrame() + if len(ids)>1: for id, f in zip(ids,csvfilenames): try: @@ -728,11 +730,13 @@ def getsmallrowdata_db(columns,ids=[],debug=False): df = pd.concat(data,axis=0) except ValueError: df = pd.DataFrame() - else: + elif len(ids)==1: try: df = pd.read_parquet(csvfilenames[0],columns=columns,engine='pyarrow') except (OSError,IndexError): df = pd.DataFrame() + else: + df = pd.DataFrame() return df diff --git a/rowers/tasks.py b/rowers/tasks.py index ab2c9261..e812a363 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -1754,15 +1754,15 @@ def handle_updatefitnessmetric(user_id,mode,workoutids,debug=False, def handle_updatecp(rower_id,workoutids,debug=False,table='cpdata',**kwargs): columns = ['power','workoutid','time'] df = getsmallrowdata_db(columns,ids=workoutids,debug=debug) - dfgrouped = df.groupby(['workoutid']) - if not df.empty: - maxt = 1.05*df['time'].max()/1000. - else: - maxt = 1000. + if df.empty: + return 0 + + maxt = 1.05*df['time'].max()/1000. logarr = datautils.getlogarr(maxt) + dfgrouped = df.groupby(['workoutid']) delta,cpvalue,avgpower = datautils.getcp(dfgrouped,logarr) diff --git a/rowers/templates/embedded_video.html b/rowers/templates/embedded_video.html index 480dad9d..298577e6 100644 --- a/rowers/templates/embedded_video.html +++ b/rowers/templates/embedded_video.html @@ -44,7 +44,7 @@ function copyText() { var tempInput = document.createElement("input"); tempInput.style = "position: absolute; left: -1000px; top: -1000px"; - tempInput.value = "https://rowsandall.com/rowers/video/{{ analysis.id|encode }}/"; + tempInput.value = "{{ siteurl }}/rowers/video/{{ analysis.id|encode }}/"; document.body.appendChild(tempInput); tempInput.select(); document.execCommand("copy"); @@ -123,7 +123,7 @@ function copyText() { {% if analysis %}
For Challenges, the default criterium is 'At Least'
"); @@ -228,7 +228,7 @@ } - ); + ); diff --git a/rowers/templates/plannedsessionscoach.html b/rowers/templates/plannedsessionscoach.html index 23540b2d..cc9a747a 100644 --- a/rowers/templates/plannedsessionscoach.html +++ b/rowers/templates/plannedsessionscoach.html @@ -23,14 +23,14 @@@@ -129,7 +129,7 @@ {% else %}
Time: Set value to minutes
"); } - + if (this.value == 'rScore') { $("td #id_sessionunit").prop("value","None"); $('#id_guidance').html("rScore has no unit
"); } - + }); - + $("td #id_sessiontype").change(function() { - + if (this.value == 'session') { $("td #id_criterium").prop("value","none"); $('#id_guidance').html("For Training Sessions, the default criterium is 'Approximately'
"); @@ -205,18 +208,18 @@ $("td #id_criterium").prop("value","minimum"); $('#id_guidance').html("For Challenges, the default criterium is 'At Least'
"); } - + if (this.value == 'cycletarget') { $("td #id_criterium").prop("value","none"); $('#id_guidance').html("For Cycle Targets, the default criterium is 'Approximately'
"); } - + } - + ); - + $("td #id_sessionunit").change(function() { - + if (this.value == 'm') { $("td #id_sessionmode").prop("value","distance"); $('#id_guidance').html("Mode was set to distance
"); @@ -233,13 +236,13 @@ $("td #id_sessionmode").prop("value","time"); $('#id_guidance').html("Mode was set to time
"); } - + } - - ); - - - + + ); + + + }); diff --git a/rowers/templates/plannedsessionteamedit.html b/rowers/templates/plannedsessionteamedit.html index 5bec388a..160a374e 100644 --- a/rowers/templates/plannedsessionteamedit.html +++ b/rowers/templates/plannedsessionteamedit.html @@ -19,10 +19,10 @@Selecting a team assigns this session to all members of the team. Unselecting a team does not remove rowers - who are already assigned to this session. Use the Rowers selection for that. + who are already assigned to this session. Use the Rowers selection for that.
+ Login {{ rower.user }} +
{% if userform.errors %}Please correct the error{{ form.errors|pluralize }} below. @@ -26,7 +29,7 @@ {% endif %} {% if accountform.errors %}
- +
{% endif %}