new interval parser
This commit is contained in:
@@ -83,7 +83,7 @@
|
|||||||
<td>8 times 500m with 3 minutes 30 seconds rest</td>
|
<td>8 times 500m with 3 minutes 30 seconds rest</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>4x(500m+500m)/5min</td><td>4 times 1km, but each km is reported as two 500m intervals without rest</td>
|
<td>4x((500m+500m)/5min)</td><td>4 times 1km, but each km is reported as two 500m intervals without rest. Note the nested parentheses.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>2x500m/500m</td><td>A 2k rowed as 500m "on", 500m "off"</td>
|
<td>2x500m/500m</td><td>A 2k rowed as 500m "on", 500m "off"</td>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ from django.db import IntegrityError, transaction
|
|||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from matplotlib.backends.backend_agg import FigureCanvas
|
from matplotlib.backends.backend_agg import FigureCanvas
|
||||||
import gc
|
import gc
|
||||||
|
from pyparsing import ParseException
|
||||||
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.http import (
|
from django.http import (
|
||||||
@@ -10926,8 +10927,8 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
|||||||
s = cd["intervalstring"]
|
s = cd["intervalstring"]
|
||||||
try:
|
try:
|
||||||
rowdata.updateinterval_string(s)
|
rowdata.updateinterval_string(s)
|
||||||
except IndexError:
|
except ParseException,err:
|
||||||
messages.error(request,'Interval string parse error')
|
messages.error(request,'Parsing error in column '+str(err.col))
|
||||||
intervalstats = rowdata.allstats()
|
intervalstats = rowdata.allstats()
|
||||||
itime,idist,itype = rowdata.intervalstats_values()
|
itime,idist,itype = rowdata.intervalstats_values()
|
||||||
nrintervals = len(idist)
|
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
|
# we are saving the results obtained from the mini language interpreter
|
||||||
elif request.method == 'POST' and "savestringform" in request.POST:
|
elif request.method == 'POST' and "savestringform" in request.POST:
|
||||||
s = request.POST["savestringform"]
|
s = request.POST["savestringform"]
|
||||||
|
try:
|
||||||
rowdata.updateinterval_string(s)
|
rowdata.updateinterval_string(s)
|
||||||
|
except ParseException,err:
|
||||||
|
messages.error(request,'Parsing error in column '+str(err.col))
|
||||||
|
|
||||||
intervalstats = rowdata.allstats()
|
intervalstats = rowdata.allstats()
|
||||||
itime,idist,itype = rowdata.intervalstats_values()
|
itime,idist,itype = rowdata.intervalstats_values()
|
||||||
nrintervals = len(idist)
|
nrintervals = len(idist)
|
||||||
|
|||||||
Reference in New Issue
Block a user