From 3711d2140ecb34a661533e11494a5af9b62d4f9e Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Wed, 22 Feb 2017 10:19:00 +0100 Subject: [PATCH] changed duration check in dataprep (h>23, min>59, etc) --- rowers/dataprep.py | 19 +++++++++++++++++-- rowers/views.py | 5 ++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/rowers/dataprep.py b/rowers/dataprep.py index d212f517..71e6d585 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -295,15 +295,30 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower', totaltime = totaltime+row.df.ix[0,' ElapsedTime (sec)'] - + hours = int(totaltime/3600.) if hours>23: - message = 'Warning: The workout duration was longer than 23 hours' + message = 'Warning: The workout duration was longer than 23 hours. ' hours = 23 minutes = int((totaltime - 3600.*hours)/60.) + if minutes>59: + minutes = 59 + if not message: + message = 'Warning: there is something wrong with the workout duration' + seconds = int(totaltime - 3600.*hours - 60.*minutes) + if seconds > 59: + seconds = 59 + if not message: + message = 'Warning: there is something wrong with the workout duration' + tenths = int(10*(totaltime - 3600.*hours - 60.*minutes - seconds)) + if tenths > 9: + tenths = 9 + if not message: + message = 'Warning: there is something wrong with the workout duration' + duration = "%s:%s:%s.%s" % (hours,minutes,seconds,tenths) if dosummary: diff --git a/rowers/views.py b/rowers/views.py index 7ac02cb7..31b88755 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -4902,7 +4902,10 @@ def workout_summary_edit_view(request,id,message="",successmessage="" nrintervals = len(idist) row.summary = intervalstats #intervalstats = rowdata.allstats() - row.notes += "\n"+s + row.notes += u'{n} \n {s}'.format( + n = row.notes, + s = s + ) row.save() rowdata.write_csv(f1,gzip=True) dataprep.update_strokedata(id,rowdata.df)