fix zero division
This commit is contained in:
@@ -199,14 +199,26 @@ def get_execution_report(rower,startdate,enddate,plan=None):
|
|||||||
|
|
||||||
for w in ws:
|
for w in ws:
|
||||||
if w.rscore != 0:
|
if w.rscore != 0:
|
||||||
plannedscore += w.rscore/ratio
|
if ratio > 0:
|
||||||
actualscore += w.rscore
|
plannedscore += w.rscore/ratio
|
||||||
|
actualscore += w.rscore
|
||||||
|
else:
|
||||||
|
plannedscore += 60
|
||||||
|
actualscore += 0
|
||||||
elif w.hrtss != 0:
|
elif w.hrtss != 0:
|
||||||
plannedscore += w.hrtss/ratio
|
if ratio > 0:
|
||||||
actualscore += w.hrtss
|
plannedscore += w.hrtss/ratio
|
||||||
|
actualscore += w.hrtss
|
||||||
|
else:
|
||||||
|
plannedscore += 60
|
||||||
|
actualscore += 0
|
||||||
else:
|
else:
|
||||||
minutes = w.duration.hour*60+w.duration.minute
|
minutes = w.duration.hour*60+w.duration.minute
|
||||||
plannedscore += minutes/ratio
|
if ration > 0:
|
||||||
|
plannedscore += minutes/ratio
|
||||||
|
else:
|
||||||
|
plannedscore += 60
|
||||||
|
|
||||||
actualscore += minutes
|
actualscore += minutes
|
||||||
|
|
||||||
actualscore = int(actualscore)
|
actualscore = int(actualscore)
|
||||||
|
|||||||
Reference in New Issue
Block a user