Reviewed cases for US on tasks graph
parent
2036ba4951
commit
77f80308f0
|
@ -59,13 +59,15 @@ class MilestoneViewSet(NotificationSenderMixin, ModelCrudViewSet):
|
||||||
'days': []
|
'days': []
|
||||||
}
|
}
|
||||||
current_date = milestone.estimated_start
|
current_date = milestone.estimated_start
|
||||||
optimal_points = sum(total_points.values())
|
sumTotalPoints = sum(total_points.values())
|
||||||
optimal_points_per_day = sum(total_points.values()) / (milestone.estimated_finish - milestone.estimated_start).days
|
optimal_points = sumTotalPoints
|
||||||
|
milestone_days = (milestone.estimated_finish - milestone.estimated_start).days
|
||||||
|
optimal_points_per_day = sumTotalPoints / milestone_days if milestone_days else 0
|
||||||
while current_date <= milestone.estimated_finish:
|
while current_date <= milestone.estimated_finish:
|
||||||
milestone_stats['days'].append({
|
milestone_stats['days'].append({
|
||||||
'day': current_date,
|
'day': current_date,
|
||||||
'name': current_date.day,
|
'name': current_date.day,
|
||||||
'open_points': sum(total_points.values()) - sum(milestone.closed_points_by_date(current_date).values()),
|
'open_points': sumTotalPoints - sum(milestone.closed_points_by_date(current_date).values()),
|
||||||
'optimal_points': optimal_points,
|
'optimal_points': optimal_points,
|
||||||
})
|
})
|
||||||
current_date = current_date + datetime.timedelta(days=1)
|
current_date = current_date + datetime.timedelta(days=1)
|
||||||
|
|
|
@ -12,6 +12,7 @@ from greenmine.projects.userstories.models import UserStory
|
||||||
import reversion
|
import reversion
|
||||||
import itertools
|
import itertools
|
||||||
import copy
|
import copy
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
class Milestone(WatchedMixin):
|
class Milestone(WatchedMixin):
|
||||||
|
@ -152,7 +153,7 @@ class Milestone(WatchedMixin):
|
||||||
}
|
}
|
||||||
|
|
||||||
def closed_points_by_date(self, date):
|
def closed_points_by_date(self, date):
|
||||||
return self._get_user_stories_points([us for us in self.user_stories.filter(finish_date__lte=date)
|
return self._get_user_stories_points([us for us in self.user_stories.filter(finish_date__lt=date + datetime.timedelta(days=1))
|
||||||
if us.is_closed])
|
if us.is_closed])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue