Fixing method total_closed_points_by_date for milestone model

remotes/origin/issue/4795/notification_even_they_are_disabled
Alejandro Alonso 2016-10-11 08:58:25 +02:00
parent 922571c56b
commit 8c3fed2088
1 changed files with 13 additions and 7 deletions

View File

@ -133,7 +133,11 @@ class Milestone(WatchedModelMixin, models.Model):
# for that date
# This calulation is the total user story points divided by its number of tasks
for task in tasks:
user_story = user_stories[task.user_story.id]
user_story = user_stories.get(task.user_story.id, None)
if user_story is None:
total_us_points = 0
us_tasks_counter = 0
else:
total_us_points = user_story._total_us_points
us_tasks_counter = user_story.num_tasks
@ -144,7 +148,9 @@ class Milestone(WatchedModelMixin, models.Model):
finished_date = self.estimated_start
points_by_date = self._total_closed_points_by_date.get(finished_date, 0)
if us_tasks_counter != 0:
points_by_date += total_us_points / us_tasks_counter
self._total_closed_points_by_date[finished_date] = points_by_date
# At this point self._total_closed_points_by_date keeps a dict where the