Пример #1
0
def team(team_slug=None):
    from kardboard.services.boards import TeamBoard

    teams = _get_teams()
    team = _find_team_by_slug(team_slug, teams)

    try:
        wip_limit_config = app.config['WIP_LIMITS'][team_slug]
    except KeyError:
        wip_limit_config = {}

    conwip = wip_limit_config.get('conwip', None)
    wip_limits = WIPLimits(
        name=team_slug,
        conwip=conwip,
        columns=wip_limit_config,
    )

    weeks = 4
    exclude_classes = _get_excluded_classes()
    team_stats = teams_service.TeamStats(team.name, exclude_classes)
    weekly_throughput = team_stats.weekly_throughput_ave(weeks)

    hit_sla = team_stats.hit_sla(weeks)
    hit_sla_delta = team_stats.hit_sla(weeks, weeks_offset=weeks)
    hit_sla, hit_sla_delta = zero_if_none(hit_sla), zero_if_none(hit_sla_delta)
    hit_sla_delta = hit_sla - hit_sla_delta

    total_throughput = teams_service.TeamStats(team.name).throughput(weeks)
    total_throughput_delta = teams_service.TeamStats(team.name).throughput(
        weeks, weeks_offset=weeks)
    total_throughput, total_throughput_delta = zero_if_none(
        total_throughput), zero_if_none(total_throughput_delta)
    total_throughput_delta = total_throughput - total_throughput_delta

    cycle_time = team_stats.percentile(.8, weeks)
    cycle_time_delta = team_stats.percentile(.8, weeks, weeks_offset=weeks)
    cycle_time, cycle_time_delta = zero_if_none(cycle_time), zero_if_none(
        cycle_time_delta)
    cycle_time_delta = cycle_time - cycle_time_delta

    metrics = [
        {
            'name': 'Throughput',
            'value': total_throughput,
            'delta': total_throughput_delta,
        },
        {
            'name': 'Hit SLA',
            'value': hit_sla,
            'delta': hit_sla_delta,
        },
        {
            'name': 'Cycle time',
            'value': cycle_time,
            'delta': cycle_time_delta,
        },
    ]

    board = TeamBoard(team.name, States(), wip_limits)
    backlog_limit = weekly_throughput * 4 or 30
    cards = Kard.objects.for_team_board(
        team=team.name,
        backlog_limit=backlog_limit,
        done_days=7,
    )
    board.add_cards(cards)

    backlog_marker_data, backlog_markers = _team_backlog_markers(
        team,
        board.columns[0]['cards'],
        weeks,
    )

    report_config = (
        {
            'slug': 'assignee',
            'name': "Assignee"
        },
        {
            'slug': 'cycle/distribution/all',
            'name': "Cycle time",
            'months': 1
        },
        {
            'slug': 'service-class',
            'name': 'Service class'
        },
        {
            'slug': 'blocked',
            'name': 'Blocked',
            'months': 3
        },
        {
            'slug': 'done',
            'name': 'Done',
            'months': 1
        },
        {
            'slug': 'leaderboard',
            'name': 'Leaderboard',
            'months': 3
        },
        {
            'slug': 'flow/detail',
            'name': "Cumulative Flow",
            'months': 2
        },
    )

    context = {
        'title': "%s cards" % team.name,
        'metrics': metrics,
        'wip_limits': wip_limits,
        'team': team,
        'teams': teams,
        'board': board,
        'round': round,
        'backlog_markers': backlog_markers,
        'backlog_marker_data': backlog_marker_data,
        'weekly_throughput': weekly_throughput,
        'report_config': report_config,
        'updated_at': datetime.datetime.now(),
        'version': VERSION,
        'authenticated': kardboard.auth.is_authenticated(),
    }

    return render_template('team.html', **context)
Пример #2
0
def team(team_slug=None):
    from kardboard.services.boards import TeamBoard

    teams = _get_teams()
    team = _find_team_by_slug(team_slug, teams)

    try:
        wip_limit_config = app.config['WIP_LIMITS'][team_slug]
    except KeyError:
        wip_limit_config = {}

    conwip = wip_limit_config.get('conwip', None)
    wip_limits = WIPLimits(
        name=team_slug,
        conwip=conwip,
        columns=wip_limit_config,
    )

    weeks = 4
    exclude_classes = _get_excluded_classes()
    team_stats = teams_service.TeamStats(team.name, exclude_classes)
    weekly_throughput = team_stats.weekly_throughput_ave(weeks)
    metrics = [
        {'WIP': team_stats.wip_count()},
        {'Weekly throughput': team_stats.weekly_throughput_ave(weeks)},
    ]
    ave = team_stats.average(weeks)
    if ave:
        metrics.append({'Cycle time ave.': team_stats.average(weeks)})

    stdev = team_stats.standard_deviation(weeks)
    if stdev:
        metrics.append({'Standard deviation': stdev},)

    board = TeamBoard(team.name, States(), wip_limits)
    backlog_limit = weekly_throughput * 4 or 30
    cards = Kard.objects.for_team_board(
        team=team.name,
        backlog_limit=backlog_limit,
        done_days=7,
    )
    board.add_cards(cards)

    backlog_marker_data, backlog_markers = _team_backlog_markers(
        team,
        board.columns[0]['cards'],
        weeks,
    )
    metrics.append(
        {'80% confidence': backlog_marker_data['confidence_80']},
    )

    report_config = (
        {'slug': 'cycle/distribution/all', 'name': "Cycle time"},
        {'slug': 'flow/detail', 'name': "Cumulative Flow"},
        {'slug': 'done', 'name': 'Done'},
        {'slug': 'service-class', 'name': 'Service class'},
    )

    context = {
        'title': "%s cards" % team.name,
        'metrics': metrics,
        'wip_limits': wip_limits,
        'team': team,
        'teams': teams,
        'board': board,
        'backlog_markers': backlog_markers,
        'backlog_marker_data': backlog_marker_data,
        'weekly_throughput': weekly_throughput,
        'report_config': report_config,
        'updated_at': datetime.datetime.now(),
        'version': VERSION,
        'authenticated': kardboard.auth.is_authenticated(),
    }

    return render_template('team.html', **context)