From eb50792139f4e00a4afe819385279d46f8d33cea Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 13 Dec 2018 17:50:45 +0100 Subject: [PATCH 01/11] bug fix --- rowers/dataprepnodjango.py | 8 +++++--- rowers/tests.py | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/rowers/dataprepnodjango.py b/rowers/dataprepnodjango.py index 92dccaa2..a6e23bf0 100644 --- a/rowers/dataprepnodjango.py +++ b/rowers/dataprepnodjango.py @@ -149,9 +149,11 @@ def create_c2_stroke_data_db( totalseconds += duration.second totalseconds += duration.microsecond/1.e6 - - spm = 60.*nr_strokes/totalseconds - + try: + spm = 60.*nr_strokes/totalseconds + except ZeroDivisionError: + spm = 20*zeros(nr_strokes) + step = totalseconds/float(nr_strokes) elapsed = np.arange(nr_strokes)*totalseconds/(float(nr_strokes-1)) diff --git a/rowers/tests.py b/rowers/tests.py index 1171ada4..c98ca1de 100644 --- a/rowers/tests.py +++ b/rowers/tests.py @@ -1070,13 +1070,29 @@ boattype: 4x a = MessageAttachment(message=m,document=a2[6:]) a.save() + m = Message(mailbox=workoutsbox, + from_header = u.email, + subject = "3x(5min/2min)/r2 \r2", + body = """ +chart time +workout water + """) + m.save() + a2 = 'media/mailbox_attachments/colin2.csv' + copyfile('rowers/testdata/emails/colin.csv',a2) + a = MessageAttachment(message=m,document=a2[6:]) + a.save() + def tearDown(self): for filename in os.listdir('media/mailbox_attachments'): path = os.path.join('media/mailbox_attachments/',filename) if not os.path.isdir(path): - os.remove(path) - + try: + os.remove(path) + except IOError: + pass + @patch('requests.get', side_effect=mocked_requests) def test_emailprocessing(self, mock_get): out = StringIO() From ca823532e04f4236fd65abd52a3e5bf75b81f7dc Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 14 Dec 2018 14:28:44 +0100 Subject: [PATCH 02/11] pinterest button --- rowers/templates/show_graph.html | 7 +++++++ rowers/templates/virtualevent.html | 19 +++++++++++-------- templates/newbase.html | 6 ++++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/rowers/templates/show_graph.html b/rowers/templates/show_graph.html index f4ac2a77..3daeff86 100644 --- a/rowers/templates/show_graph.html +++ b/rowers/templates/show_graph.html @@ -41,6 +41,13 @@

+

+ + + + +

  • {% if user.is_authenticated and user == rower.user %} diff --git a/rowers/templates/virtualevent.html b/rowers/templates/virtualevent.html index 5698a83e..042f8cc6 100644 --- a/rowers/templates/virtualevent.html +++ b/rowers/templates/virtualevent.html @@ -35,16 +35,19 @@ Share -

    -

    -

    -{% else %} -data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{ race.name }}'">Tweet + data-url="{{ request.build_absolute_uri }}" + {% if race.sessiontype == 'race' %} + data-text="@rowsandall #rowingdata Participate in virtual race '{{ race.name }}'">Tweet + {% else %} + data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{ race.name }}'">Tweet {% endif %} +

    + +

    diff --git a/templates/newbase.html b/templates/newbase.html index 755e5667..00ddebf6 100644 --- a/templates/newbase.html +++ b/templates/newbase.html @@ -95,6 +95,12 @@ +