User story points are undefined if the task points are undefined

remotes/origin/enhancement/email-actions
Alejandro Alonso 2014-11-18 10:16:18 +01:00
parent 5129c1f1e1
commit 058195d670
1 changed files with 9 additions and 3 deletions

View File

@ -126,9 +126,15 @@ class UserStory(OCCModelMixin, WatchedModelMixin, BlockedMixin, TaggedMixin, mod
return self.role_points
def get_total_points(self):
not_null_role_points = self.role_points.select_related("points").\
exclude(points__value__isnull=True)
#If we only have None values the sum should be None
if not not_null_role_points:
return None
total = 0.0
for rp in self.role_points.select_related("points"):
if rp.points.value:
for rp in not_null_role_points:
total += rp.points.value
return total