From 5061cbcd1cd4335a606f41532a4792fbc023edb4 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 7 Nov 2017 17:00:18 +0100 Subject: [PATCH] work in progress: now has alternative way to find chart settings --- rowers/uploads.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/rowers/uploads.py b/rowers/uploads.py index a6fab4a1..e05eca04 100644 --- a/rowers/uploads.py +++ b/rowers/uploads.py @@ -19,6 +19,9 @@ import yamllint from subprocess import call import re +from verbal_expressions import VerEx + + import django_rq queue = django_rq.get_queue('default') queuelow = django_rq.get_queue('low') @@ -45,6 +48,29 @@ def cleanbody(body): return body +def matchchart(line): + results = [] + tester = VerEx().start_of_line().find('chart') + tester2 = VerEx().start_of_line().find('chart').anything().find('distance') + tester3 = VerEx().start_of_line().find('chart').anything().find('time') + tester4 = VerEx().start_of_line().find('chart').anything().find('pie') + if tester.match(line): + if tester2.match(line): + return 'distanceplot' + if tester3.match(line): + return 'timeplot' + if tester3.match(line): + return 'pieplot' + +def get_plotoptions_body2(uploadoptions,body): + for line in body.splitlines(): + chart = matchchart(line) + if chart: + uploadoptions['make_plot'] = True + uploadoptions['plottype'] = chart + + + def getsyncoptions(uploadoptions,values): try: value = values.lower()