Private
Public Access
1
0

added zerodivision test in consistency checks

This commit is contained in:
Sander Roosendaal
2017-06-21 20:38:45 +02:00
parent 46dec13405
commit 3ebbaa80ca

View File

@@ -442,16 +442,18 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
pass pass
return new_workout_from_df(r,newdf, return new_workout_from_df(r,newdf,
title=title) title=title)
try:
checks = row.check_consistency() checks = row.check_consistency()
allchecks = 1 allchecks = 1
for key,value in checks.iteritems(): for key,value in checks.iteritems():
if not value: if not value:
allchecks = 0 allchecks = 0
if consistencychecks: if consistencychecks:
a_messages.error(r.user,'Failed consistency check: '+key+', autocorrected') a_messages.error(r.user,'Failed consistency check: '+key+', autocorrected')
else: else:
a_messages.error(r.user,'Failed consistency check: '+key+', not corrected') a_messages.error(r.user,'Failed consistency check: '+key+', not corrected')
except ZeroDivisionError:
pass
if not allchecks and consistencychecks: if not allchecks and consistencychecks:
# row.repair() # row.repair()