def testGetBacklogListCommand(self): """Tests that the BacklogModule returns the list of Backlogs configured""" cmd_list = BacklogController.ListBacklogsCommand(self.env) blist = self.controller.process_command(cmd_list) self.assert_length(2, blist) # Only Product Backlog and Sprint Backlog # the list is returned ordered by type and than by name self.assert_equals(Key.PRODUCT_BACKLOG, blist[0][Key.NAME]) self.assert_equals(Key.SPRINT_BACKLOG, blist[1][Key.NAME])
def send_backlog_list_data(self, req, data): """add to the data array the backlog data necessary to show the backlog list""" def milestone_options(milestones, selected): """ Return three lists of tuple (milestone_name, selected) for the milestones which are: - Open with a due date - Open without a due date - Closed """ open_with_due_date = list() open_without_due_date = list() closed = list() for m in milestones: m_list = None if m.is_completed: m_list = closed elif m.due: m_list = open_with_due_date else: m_list = open_without_due_date # append the milestone to the list m_list.append((m.name, m.name == selected)) return open_with_due_date, open_without_due_date, closed # Maximum items in the pulldown, ordered by status and by time # The number is the maximum per status, so 5 closed, 5 running # and 5 to start MAX_ITEMS = 5 milestone_list = None if data is not None and Action.BACKLOG_VIEW in req.perm: data['sprint_list'] = self.running_to_start_closed_sprints(req) cmd_list = BacklogController.ListBacklogsCommand(self.env) data['backlog_list'] = \ BacklogController(self.env).process_command(cmd_list) s_milestone = SessionScope(req).milestone_name() open_due, open, closed = \ milestone_options(AgiloMilestone.select(self.env), s_milestone) milestone_list = [{ Key.LABEL: _('Open (by Due Date)'), Key.OPTIONS: open_due }, { Key.LABEL: _('Open (no Due Date)'), Key.OPTIONS: open }, { Key.LABEL: _('Closed'), Key.OPTIONS: closed[-MAX_ITEMS:] }] data['milestone_list'] = milestone_list
def _get_backlogs(self): select_cmd = BacklogController.ListBacklogsCommand(self.env) return BacklogController(self.env).process_command(select_cmd)