def team(team_slug=None): date = datetime.datetime.now() date = make_end_date(date=date) teams = app.config.get("CARD_TEAMS", []) team_mapping = {} for team in teams: team_mapping[slugify(team)] = team target_team = None if team_slug: target_team = team_mapping.get(team_slug, None) if not team: abort(404) board = DisplayBoard(teams=[target_team]) metrics = [ { "Ave. Cycle Time": Kard.objects.filter(team=target_team).moving_cycle_time( year=date.year, month=date.month, day=date.day ) }, { "Done this week": Kard.objects.filter(team=target_team) .done_in_week(year=date.year, month=date.month, day=date.day) .count() }, { "Done this month": Kard.objects.filter(team=target_team) .done_in_month(year=date.year, month=date.month, day=date.day) .count() }, {"On the board": len(board.cards)}, ] done_cards = Kard.objects.done().filter(team=target_team).order_by("-done_date") title = "%s cards" % target_team report_config = ( {"slug": "cycle", "name": "Cycle time"}, {"slug": "classes", "name": "Throughput"}, {"slug": "leaderboard", "name": "Leaderboard"}, ) context = { "title": title, "team_slug": team_slug, "target_team": target_team, "done_cards": done_cards, "metrics": metrics, "report_config": report_config, "board": board, "date": date, "updated_at": datetime.datetime.now(), "version": VERSION, } return render_template("team.html", **context)
def started_after_report(team_or_rg_name, start_date): start_date = make_start_date(date=start_date) cards = _get_cards(team_or_rg_name, start_date) columns = ( 'key', 'team', 'service_class', 'type', 'start_date', 'done_date', 'due_date', 'cycle_time', 'is_wip', 'hit_due_date', 'hit_sla', 'time_in_otis', 'time_wait_qa', 'time_in_qa', 'time_building', 'time_elabo', ) Row = namedtuple('Row', ' '.join(columns)) rows = [] for c in cards: row = Row( key=c.key, team=c.team, service_class=c.service_class['name'], type=_card_type(c), start_date=_format_date_or_empty(c.start_date), done_date=_format_date_or_empty(c.done_date), due_date=_format_date_or_empty(c.due_date), cycle_time=c.cycle_time or c.current_cycle_time(), is_wip=(c.done_date is None), hit_due_date=_hit_due_date(c), hit_sla=_hit_sla(c), time_in_otis=_time_in_otis(c), time_wait_qa=_time_wait_qa(c), time_in_qa=_time_in_qa(c), time_building=_time_building(c), time_elabo=_time_elabo(c), ) rows.append(row) rows.insert(0, columns) report_filename = "%s_%s.csv" % ( start_date.strftime('%Y-%m-%d'), slugify(team_or_rg_name) ) writer = csv.writer( open(report_filename, 'w'), ) writer.writerows(rows)
def team(team_slug=None): date = datetime.datetime.now() date = make_end_date(date=date) teams = app.config.get('CARD_TEAMS', []) team_mapping = {} for team in teams: team_mapping[slugify(team)] = team target_team = None if team_slug: target_team = team_mapping.get(team_slug, None) if not team: abort(404) board = DisplayBoard(teams=[target_team, ]) metrics = [ {'Ave. Cycle Time': Kard.objects.filter(team=target_team).moving_cycle_time( year=date.year, month=date.month, day=date.day)}, {'Done this week': Kard.objects.filter(team=target_team).done_in_week( year=date.year, month=date.month, day=date.day).count()}, {'Done this month': Kard.objects.filter(team=target_team).done_in_month( year=date.year, month=date.month, day=date.day).count()}, {'On the board': len(board.cards)}, ] done_cards = Kard.objects.done().filter(team=target_team).order_by('-done_date') title = "%s cards" % target_team report_config = ( {'slug': 'cycle', 'name': 'Cycle time'}, {'slug': 'classes', 'name': 'Throughput'}, {'slug': 'leaderboard', 'name': 'Leaderboard'}, ) context = { 'title': title, 'team_slug': team_slug, 'target_team': target_team, 'done_cards': done_cards, 'metrics': metrics, 'report_config': report_config, 'board': board, 'date': date, 'updated_at': datetime.datetime.now(), 'version': VERSION, } return render_template('team.html', **context)
def _get_target_url(self, team): team_slug = slugify(team) return '/team/%s/' % team_slug
def slug(self): return slugify(self.name)
def _get_target_url(self, state): state_slug = slugify(state) return '/funnel/%s/' % state_slug
def team(team_slug=None): date = datetime.datetime.now() date = make_end_date(date=date) teams = app.config.get("CARD_TEAMS", []) states = States() team_mapping = {} for team in teams: team_mapping[slugify(team)] = team target_team = None if team_slug: target_team = team_mapping.get(team_slug, None) if not team: abort(404) board = DisplayBoard(teams=[target_team]) wip_cards = [k for k in board.cards if k.state in states.in_progress] done_this_week = [k for k in board.cards if k.state == states.done] three_months_ago = date - relativedelta.relativedelta(months=3) done_past_three_months = Kard.objects.filter( team=target_team, done_date__exists=True, done_date__gte=three_months_ago ) std_dev = standard_deviation([k.cycle_time for k in done_past_three_months]) ave_cycle_time = Kard.objects.filter(team=target_team).moving_cycle_time( year=date.year, month=date.month, day=date.day ) confidence_cycle = round(ave_cycle_time + std_dev + std_dev) try: confidence_cycle = int(confidence_cycle) except ValueError: pass metrics = [ {"WIP": len(wip_cards)}, {"Ave. Cycle Time": ave_cycle_time}, {"95% confidence level": confidence_cycle}, {"Done this week": len(done_this_week)}, ] title = "%s cards" % target_team report_config = ( {"slug": "assignee", "name": "Assignee breakdown"}, {"slug": "cycle/distribution", "name": "Cycle time"}, {"slug": "throughput", "name": "Throughput"}, {"slug": "leaderboard", "name": "Leaderboard"}, {"slug": "done", "name": "Done"}, ) context = { "title": title, "team_slug": team_slug, "target_team": target_team, "metrics": metrics, "report_config": report_config, "board": board, "date": date, "updated_at": datetime.datetime.now(), "version": VERSION, } return render_template("team.html", **context)
def find_by_slug(self, slug): by_slug = {} for state in self: by_slug[slugify(state)] = state return by_slug[slug]
def team(team_slug=None): date = datetime.datetime.now() date = make_end_date(date=date) teams = app.config.get('CARD_TEAMS', []) states = States() team_mapping = {} for team in teams: team_mapping[slugify(team)] = team target_team = None if team_slug: target_team = team_mapping.get(team_slug, None) if not team: abort(404) board = DisplayBoard(teams=[ target_team, ]) wip_cards = [k for k in board.cards if k.state in states.in_progress] done_this_week = [k for k in board.cards if k.state == states.done] three_months_ago = date - relativedelta.relativedelta(months=3) done_past_three_months = Kard.objects.filter( team=target_team, done_date__exists=True, done_date__gte=three_months_ago) std_dev = standard_deviation( [k.cycle_time for k in done_past_three_months]) ave_cycle_time = Kard.objects.filter(team=target_team).moving_cycle_time( year=date.year, month=date.month, day=date.day) confidence_cycle = round(ave_cycle_time + std_dev + std_dev) try: confidence_cycle = int(confidence_cycle) except ValueError: pass metrics = [ { 'WIP': len(wip_cards) }, { 'Ave. Cycle Time': ave_cycle_time }, { '95% confidence level': confidence_cycle }, { 'Done this week': len(done_this_week) }, ] title = "%s cards" % target_team report_config = ({ 'slug': 'assignee', 'name': 'Assignee breakdown' }, { 'slug': 'cycle/distribution', 'name': 'Cycle time' }, { 'slug': 'throughput', 'name': 'Throughput' }, { 'slug': 'leaderboard', 'name': 'Leaderboard' }, { 'slug': 'done', 'name': 'Done' }) context = { 'title': title, 'team_slug': team_slug, 'target_team': target_team, 'metrics': metrics, 'report_config': report_config, 'board': board, 'date': date, 'updated_at': datetime.datetime.now(), 'version': VERSION, } return render_template('team.html', **context)