diff --git a/rowers/dataprep.py b/rowers/dataprep.py index d32a74a0..757254f5 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -1280,6 +1280,7 @@ def new_workout_from_file(r, f2, message = None try: fileformat = get_file_type(f2) + print(fileformat,'aa') except IOError: os.remove(f2) message = "Rowsandall could not process this file. The extension is supported but the file seems corrupt. Contact info@rowsandall.com if you think this is incorrect." @@ -1337,7 +1338,13 @@ def new_workout_from_file(r, f2, # worth supporting if fileformat == 'unknown': message = "We couldn't recognize the file type" - f4 = f2[:-5]+'a'+f2[-5:] + extension = os.path.splitext(f2)[1] + filename = os.path.splitext(f2)[0] + if extension == '.gz': + filename = os.path.splitext(filename)[0] + extension2 = os.path.splitext(filename)[1]+extension + extension = extension2 + f4 = filename+'a'+extension copyfile(f2,f4) job = myqueue(queuehigh, handle_sendemail_unrecognized, diff --git a/rowers/tasks.py b/rowers/tasks.py index f64b6c54..6a8ad981 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -1661,6 +1661,8 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename, haspower = row.df[' Power (watts)'].mean() > 50 except TypeError: haspower = True + except KeyError: + haspower = False nr_rows = len(row.df) if (plotnr in [1, 2, 4, 5, 8, 11, 9, 12]) and (nr_rows > 1200): diff --git a/rowers/templates/fitnessmetric.html b/rowers/templates/fitnessmetric.html index 7939ed15..6958985d 100644 --- a/rowers/templates/fitnessmetric.html +++ b/rowers/templates/fitnessmetric.html @@ -72,16 +72,13 @@ {% if rower.user %} -

{{ rower.user.first_name }} Power Estimates

+

Power Progress for {{ rower.user.first_name }}

{% else %} -

{{ user.first_name }} Power Estimates

+

Power Progress for {{ user.first_name }}

{% endif %}
    -
  • - {{ the_div|safe }} -
  • @@ -92,6 +89,9 @@ +
  • + {{ the_div|safe }} +
  • diff --git a/rowers/templates/list_workouts.html b/rowers/templates/list_workouts.html index 7a7db9b9..237165d7 100644 --- a/rowers/templates/list_workouts.html +++ b/rowers/templates/list_workouts.html @@ -81,7 +81,7 @@ {{ searchform }}

    - +

    diff --git a/rowers/tests/test_urls.py b/rowers/tests/test_urls.py index 83814fb7..720daa5f 100644 --- a/rowers/tests/test_urls.py +++ b/rowers/tests/test_urls.py @@ -283,7 +283,7 @@ class URLTests(TestCase): for u in urls: if u not in tested and 'rowers' in u and 'http' not in u and 'authorize' not in u and 'import' not in u and 'logout' not in u: response2 = self.c.get(u) - if response2.status_code not in [200,302]: + if response2.status_code not in [200,302,301]: print(len(tested)) print(response.templates[0].name) print(url) @@ -291,7 +291,7 @@ class URLTests(TestCase): print(response2.status_code) tested.append(u) self.assertIn(response2.status_code, - [200,302]) + [200,302,301]) else: tested.append(u) diff --git a/rowers/views/analysisviews.py b/rowers/views/analysisviews.py index 8784e060..86a21740 100644 --- a/rowers/views/analysisviews.py +++ b/rowers/views/analysisviews.py @@ -611,11 +611,24 @@ def fitnessmetric_view(request,id=0,mode='rower', enddate=enddate, ) + breadcrumbs = [ + { + 'url':'/rowers/analysis', + 'name':'Analysis' + }, + { + 'url':reverse('fitnessmetric_view'), + 'name': 'Power Progress' + } + ] + + return render(request,'fitnessmetric.html', { 'rower':therower, 'active':'nav-analysis', 'chartscript':script, + 'breadcrumbs':breadcrumbs, 'the_div':thediv, 'mode':mode, 'form':form, diff --git a/rowers/views/paymentviews.py b/rowers/views/paymentviews.py index 61cba565..535eb663 100644 --- a/rowers/views/paymentviews.py +++ b/rowers/views/paymentviews.py @@ -522,9 +522,11 @@ def rower_register_view(request): title='New User Sample Data', notes='This is an example workout to get you started') newworkoutid = response[0] - w = Workout.objects.get(id=newworkoutid) - w.startdatetime = timezone.now() - w.save() + if newworkoutid: + w = Workout.objects.get(id=newworkoutid) + w.startdatetime = timezone.now() + w.date = timezone.now().date() + w.save() # Create and send email fullemail = first_name + " " + last_name + " " + "<" + email + ">"