From 09665ef5d206a13dc1ffbe18106a7b72d9230e8a Mon Sep 17 00:00:00 2001 From: user Date: Wed, 20 Mar 2013 11:30:48 +0100 Subject: [PATCH] Correction division par 0 --- todolist.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/todolist.py b/todolist.py index 14d9f16..44061c4 100644 --- a/todolist.py +++ b/todolist.py @@ -25,7 +25,7 @@ class Container(osv.Model): total += 1 if task.state == "done": done += 1 - result[container.id] = done/total + result[container.id] = total and done/total or 0. return result @@ -35,7 +35,7 @@ class Container(osv.Model): tasks = container.tasks total = len(tasks) done = len([t for t in tasks if t.state == "done"]) - result[container.id] = done/total*100. + result[container.id] = total and done/total or 0. return result -- 1.7.10.4