Ejemplo n.º 1
0
    def for_team_board(self, team, backlog_limit, done_days):
        states = States()

        in_progress_q = Q(state__in=states.in_progress, team=team)
        done_q = Q(done_date__gte=now() - relativedelta(days=done_days),
                   team=team)

        cards_query = in_progress_q | done_q
        wip_and_done = list(
            self.filter(cards_query).exclude('_ticket_system_data'))

        ordered_backlog_q = Q(state=states.backlog,
                              team=team,
                              priority__exists=True)
        unordered_backlog_q = Q(state=states.backlog,
                                team=team,
                                priority__exists=False)

        ordered_backlog_cards = self.filter(ordered_backlog_q).order_by(
            'priority', 'created_at')
        ordered_backlog_cards = ordered_backlog_cards.limit(
            backlog_limit).exclude('_ticket_system_data')
        unordered_backlog_cards = []
        if len(ordered_backlog_cards) < backlog_limit:
            ordered_backlog_cards = list(ordered_backlog_cards)
            unordered_backlog_cards = Kard.objects.filter(
                unordered_backlog_q).order_by('created_at')
            unordered_backlog_cards = unordered_backlog_cards.limit(
                backlog_limit).exclude('_ticket_system_data')

        backlog = list(ordered_backlog_cards) + list(unordered_backlog_cards)
        backlog = backlog[:backlog_limit]

        return backlog + wip_and_done
Ejemplo n.º 2
0
def report_suite(name, weeks=None, start=None, end=None):
    start, end = _get_time_range(weeks, start, end)
    try:
        team = _get_team(name)
        cards = _get_cards(team, start, end)
    except ValueError:
        rg_slug = _verify_rg(name)
        cards = _get_cards_by_report_group(rg_slug, start, end)

    card_state_time = collect_card_state_time(cards)
    averages = card_state_averages(card_state_time)
    medians = card_state_medians(card_state_time)
    stdevs = card_state_stdevs(card_state_time)

    states = States()
    unknown_states = [s for s in averages.keys() if s not in states]
    for state in states:
        print "%s,%s,%s,%s,%s,%s,%s,%s,%s" % (
            start,
            end,
            state,
            averages.get(state, "N/A"),
            medians.get(state, "N/A"),
            stdevs.get(state, "N/A"),
            len(cards),
            len([c for c in cards if c.is_card]),
            len([c for c in cards if c.is_card is False]),
        )
    for state in unknown_states:
        print "UNUSED %s\t %s" % (state, averages.get(state, "N/A"))
Ejemplo n.º 3
0
 def wip(self):
     states = States()
     wip = Kard.objects.filter(
         team=self.team_name,
         done_date=None,
         state__in=states.in_progress,
     )
     return wip
Ejemplo n.º 4
0
    def __init__(self, teams=None, done_days=7):
        self.states = States()
        self.done_days = done_days
        self._cards = None
        self._rows = []

        if teams is None:
            teams = [t for t in app.config['CARD_TEAMS'] if t]  # Remove blanks
        self.teams = teams
Ejemplo n.º 5
0
    def __init__(self, teams=None, done_days=7, backlog_limit=None):
        self.states = States()
        self.done_days = done_days
        self._cards = None
        self._rows = []
        self.backlog_limit = backlog_limit

        from kardboard.services import teams as teams_service
        if teams is None:
            teams = teams_service.setup_teams(app.config).names
        self.teams = teams
Ejemplo n.º 6
0
    def _auto_state_changes(self):
        # Auto move to done
        if self.done_date:
            states = States()
            self.in_progress = False
            self.state = states.done

        self._assignee_state_changes()

        if self.blocked:
            # Do we have a state change?
            if self.state_changing:
                self.unblock()
Ejemplo n.º 7
0
    def setUp(self):
        super(StatelogTests, self).setUp()
        from kardboard.models.states import States
        self.states = States()
        self.cards = [self.make_card() for i in xrange(0, 5)]
        [card.save() for card in self.cards]

        entered = self.now() - relativedelta(days=2)
        state = self.states[0]
        sl = self._make_one(
            entered=entered,
            state=state,
        )
        self.sl = sl
Ejemplo n.º 8
0
    def _auto_state_changes(self):
        states = States()

        # Auto move to done
        if self.done_date:
            self.in_progress = False
            self.state = states.done

        self._assignee_state_changes()

        if self.blocked:
            # Do we have a state change?
            if self.state_changing:
                self.unblock()

        if self.state not in states.orderable:
            self.priority = None
Ejemplo n.º 9
0
    def capture(klass, group='all'):
        date = datetime.datetime.now()
        date = make_end_date(date=date)
        try:
            r = klass.objects.get(date=date, group=group)
        except klass.DoesNotExist:
            r = klass()
            r.date = date
            r.group = group

        states = States()

        for state in states:
            group_cards = ReportGroup(
                group, Kard.objects.filter(state=state)).queryset
            r.state_counts[state] = group_cards.count()

            non_defects = [c for c in group_cards.only('_type') if c.is_card]
            r.state_card_counts[state] = len(non_defects)

        r.save()
        return r
Ejemplo n.º 10
0
    def setUp(self):
        from kardboard.models.states import States, State

        self.State = State
        self.mock_states = States()
        self.mock_states.states = [
            State("Backlog", None, False),
            State("Elaboration", "Ready: Building", False),
            State("Ready: Building", None, True),
            State("Building", "Ready: Testing", False),
            State("Ready: Testing", None, True),
            State("Testing", "Build to OTIS", False),
            State("Build to OTIS", None, True),
            State("OTIS Verify", "Prodward Bound", False),
            State("Proward Bound", None, True),
            State("Done", None, False),
        ]
        self.mock_states.backlog = "Backlog"
        self.mock_states.done = "Done"
        self.mock_states.pre_start = [
            "Backlog", "Elaboration", "Ready: Building"
        ]
        self.mock_wip_limits = {}