def select_backlog(request, sid): """ Select a group of backlog items to fit in the sprint timebox based on the team velocity. Velocity is passed as argument or fetched from the team or global settings. """ vs = request.GET.get('v', None) if not vs: velocity = get_velocity(get_active_product(request)) else: velocity = float(vs) est = 0.0 items = [] sp = get_object_or_404(Sprint, pk=sid) # collect existing sprint backlog items for itm in sp.backlog_set.get_query_set(): est += itm.estimate if est > velocity: # remove if overruns velocity itm.sprint = None itm.save() else: items.append(itm) if est < velocity: # add more if velocity allows for itm in Backlog.objects.filter(sprint=None): est += itm.estimate if est > velocity: break items.append(itm) itm.sprint = sp itm.save() data = {'backlog':items, 'sprint':sp, 'product':sp.product} return render(request, 'sprint_backlog', data, 'sprint/')
def select_backlog(request, sid): """ Select a group of backlog items to fit in the sprint timebox based on the team velocity. Velocity is passed as argument or fetched from the team or global settings. """ vs = request.GET.get('v', None) if not vs: velocity = get_velocity(get_active_product(request)) else: velocity = float(vs) est = 0.0 items = [] sp = get_object_or_404(Sprint, pk=sid) # collect existing sprint backlog items for itm in sp.backlog_set.get_query_set(): est += itm.estimate if est > velocity: # remove if overruns velocity itm.sprint = None itm.save() else: items.append(itm) if est < velocity: # add more if velocity allows for itm in Backlog.objects.filter(sprint=None): est += itm.estimate if est > velocity: break items.append(itm) itm.sprint = sp itm.save() data = {'backlog': items, 'sprint': sp, 'product': sp.product} return render(request, 'sprint_backlog', data, 'sprint/')
def get_context_data(self, **kwargs): context = super(SprintBacklogView, self).get_context_data(**kwargs) context['sprint'] = self.sprint context['product'] = self.sprint.product context['velocity'] = get_velocity(self.sprint.product) return context