Correction division par 0
authoruser <user@debian.inspyration>
Wed, 20 Mar 2013 10:30:48 +0000 (11:30 +0100)
committeruser <user@debian.inspyration>
Wed, 20 Mar 2013 10:30:48 +0000 (11:30 +0100)
todolist.py

index 14d9f16..44061c4 100644 (file)
@@ -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