Merge branch 'allan-simon-patch-1'

remotes/origin/issue/4795/notification_even_they_are_disabled
David Barragán Merino 2016-10-13 12:14:24 +02:00
commit 7952fb63ee
1 changed files with 6 additions and 6 deletions

View File

@ -137,14 +137,14 @@ class UserStory(OCCModelMixin, WatchedModelMixin, BlockedMixin, TaggedMixin, mod
return self.role_points return self.role_points
def get_total_points(self): def get_total_points(self):
not_null_role_points = [rp for rp in self.role_points.all() if rp.points.value is not None] not_null_role_points = [
rp.points.value
for rp in self.role_points.all()
if rp.points.value is not None
]
#If we only have None values the sum should be None #If we only have None values the sum should be None
if not not_null_role_points: if not not_null_role_points:
return None return None
total = 0.0 return sum(not_null_role_points)
for rp in not_null_role_points:
total += rp.points.value
return total