Private
Public Access
1
0

new interval parser

This commit is contained in:
Sander Roosendaal
2018-04-06 23:47:30 +02:00
parent 871ed427a6
commit 8de1d4465f
2 changed files with 9 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ from django.db import IntegrityError, transaction
from django.views.decorators.csrf import csrf_exempt
from matplotlib.backends.backend_agg import FigureCanvas
import gc
from pyparsing import ParseException
from django.shortcuts import render
from django.http import (
@@ -10926,8 +10927,8 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
s = cd["intervalstring"]
try:
rowdata.updateinterval_string(s)
except IndexError:
messages.error(request,'Interval string parse error')
except ParseException,err:
messages.error(request,'Parsing error in column '+str(err.col))
intervalstats = rowdata.allstats()
itime,idist,itype = rowdata.intervalstats_values()
nrintervals = len(idist)
@@ -10936,7 +10937,11 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
# we are saving the results obtained from the mini language interpreter
elif request.method == 'POST' and "savestringform" in request.POST:
s = request.POST["savestringform"]
rowdata.updateinterval_string(s)
try:
rowdata.updateinterval_string(s)
except ParseException,err:
messages.error(request,'Parsing error in column '+str(err.col))
intervalstats = rowdata.allstats()
itime,idist,itype = rowdata.intervalstats_values()
nrintervals = len(idist)