Ejemplo n.º 1
0
 def _sprint(self, req, sprint_name):
     try:
         get_sprint = SprintController.GetSprintCommand(self.env,
                                                        sprint=sprint_name)
         get_sprint.native = True
         return SprintController(self.env).process_command(get_sprint)
     except ICommand.NotValidError, e:
         self.error_response(req, {}, [exception_to_unicode(e)])
Ejemplo n.º 2
0
    def prepare_data(self, req, args, data=None):
        """Returns the sprint visualization data"""
        if not args:
            raise TracError("You should provide at least a sprint name: ",
                            args)
        # Assuming there is a sprint name
        name = args.get('name')

        if data is None:
            data = {}
        # avoid circular import
        from agilo.scrum.backlog.web_ui import NewBacklogView
        data.update({
            'may_edit_sprint':
            Action.SPRINT_EDIT in req.perm,
            # show a deletion confirmation if user wanted to delete
            'delete_confirmation':
            'delete' in req.args,
            'close_confirmation':
            'close' in req.args,
            'edit_form_action':
            req.href(SprintEditView.url, name, 'edit'),
            'confirm_form_action':
            req.href(SprintConfirmView.url, name, 'confirm'),
            'sprint_backlog_link':
            req.href(NewBacklogView.url, Key.SPRINT_BACKLOG, name)
        })
        list_sprints = \
            SprintController.ListSprintsCommand(self.env,
                                                criteria={'name': '!=%s' % name})
        data['sprints'] = [s.name for s in \
                           self.controller.process_command(list_sprints)]
        # Generate the date converter function for this timezone
        convert_date = view.generate_converter(req.tz)
        get_sprint = SprintController.GetSprintCommand(self.env, sprint=name)
        sprint = self.controller.process_command(get_sprint)
        # update the sprint dates
        sprint.start = convert_date(sprint.start)
        sprint.end = convert_date(sprint.end)
        # update the data with the Sprint info
        data.update({'sprint': sprint})
        # now get the sprint ticket statistics
        cmd_stats = SprintController.GetTicketsStatisticsCommand(self.env,
                                                                 sprint=name,
                                                                 totals=True)
        nr_new, nr_planned, nr_closed = self.controller.process_command(
            cmd_stats)
        data['planned_tickets'] = nr_new
        data['in_progres_tickets'] = nr_planned
        data['open_tickets'] = nr_new + nr_planned
        data['closed_tickets'] = nr_closed

        rm = AgiloRoadmapModule(self.env)
        data['sprint_stats'] = rm.build_sprint_story_statistics(req, name)

        sprint_dates = {
            'start': sprint.start,
            'end': sprint.end,
            'duration': sprint.duration
        }

        if sprint.is_closed:
            data['date_info'] = "Ended the %(end)s. Duration %(duration)s days (started the %(start)s)" % \
                                    sprint_dates
        elif sprint.is_currently_running:
            data['date_info'] = "Started the %(start)s, ends on the %(end)s." % \
                                    sprint_dates
        else:
            data['date_info'] = "Starts the %(start)s. Duration %(duration)s days, ends on the %(end)s" % \
                                    sprint_dates
        return data
Ejemplo n.º 3
0
 def _get_sprint(self, req, name):
     cmd_get = SprintController.GetSprintCommand(self.env, sprint=name)
     return self.controller.process_command(
         cmd_get, date_converter=view.generate_converter(req.tz))