def funnel(state_slug): states = States() try: state = states.find_by_slug(state_slug) funnel = Funnel(state, app.config.get('FUNNEL_VIEWS', {})[state]) except KeyError: abort(404) cards = funnel.ordered_cards() funnel_auth = False if kardboard.auth.is_authenticated() is True: funnel_auth = funnel.is_authorized(session.get('username', '')) if request.method == "POST": if kardboard.auth.is_authenticated() is False or funnel_auth is False: abort(403) start = time.time() card_key_list = request.form.getlist('card[]') counter = 1 for card_key in card_key_list: Kard.objects(key=card_key.strip()).only('priority').update_one( set__priority=counter) counter += 1 elapsed = (time.time() - start) return jsonify(message="Reordered %s cards in %.2fs" % (counter, elapsed)) title = "%s: All boards" % state funnel_markers = funnel.markers() context = { 'title': title.replace("Backlog", "Ready: Elabo").replace("OTIS", "TIE"), 'state': state, 'state_slug': state_slug, 'cards': cards, 'times_in_state': funnel.times_in_state(), 'funnel_throughput': funnel.throughput, 'funnel_markers': funnel_markers, 'funnel_auth': funnel_auth, 'updated_at': datetime.datetime.now(), 'version': VERSION, 'authenticated': kardboard.auth.is_authenticated(), } return render_template('funnel.html', **context)
def team_backlog(team_slug=None): if request.method == "POST": if kardboard.auth.is_authenticated() is False: abort(403) start = time.time() card_key_list = request.form.getlist('card[]') counter = 1 for card_key in card_key_list: Kard.objects( key=card_key.strip() ).only('priority').update_one(set__priority=counter) counter +=1 elapsed = (time.time() - start) return jsonify(message="Reordered %s cards in %.2fs" % (counter, elapsed)) teams = _get_teams() team = _find_team_by_slug(team_slug, teams) exclude_classes = _get_excluded_classes() team_stats = teams_service.TeamStats(team.name, exclude_classes) lead_time = team_stats.lead_time(weeks=12) weekly_throughput = team_stats.weekly_throughput_ave(weeks=12) backlog = Kard.objects.filter( team=team.name, state=States().backlog, ).exclude('_ticket_system_data').order_by('priority') backlog_markers = _make_backlog_markers( lead_time, weekly_throughput, backlog ) title = "%s backlog" % team.name context = { 'title': title, 'team_slug': team_slug, 'team': team, 'backlog': backlog, 'backlog_markers': backlog_markers, 'weekly_throughput': weekly_throughput, 'updated_at': datetime.datetime.now(), 'teams': teams, 'version': VERSION, 'authenticated': kardboard.auth.is_authenticated(), } return render_template('team-backlog.html', **context)
def team_backlog(team_slug=None): if request.method == "POST": if kardboard.auth.is_authenticated() is False: abort(403) start = time.time() card_key_list = request.form.getlist('card[]') counter = 1 for card_key in card_key_list: Kard.objects(key=card_key.strip()).only('priority').update_one( set__priority=counter) counter += 1 elapsed = (time.time() - start) return jsonify(message="Reordered %s cards in %.2fs" % (counter, elapsed)) teams = _get_teams() team = _find_team_by_slug(team_slug, teams) weeks = 4 backlog = Kard.objects.filter( team=team.name, state=States().backlog, ).exclude('_ticket_system_data').order_by('priority') backlog_marker_data, backlog_markers = _team_backlog_markers( team, backlog, weeks) backlog_without_order = [k for k in backlog if k.priority is None] backlog_with_order = [k for k in backlog if k.priority is not None] backlog_with_order.sort(key=lambda k: k.priority) backlog = backlog_with_order + backlog_without_order title = "%s" % team.name context = { 'title': title, 'team_slug': team_slug, 'team': team, 'backlog': backlog, 'backlog_markers': backlog_markers, 'backlog_marker_data': backlog_marker_data, 'updated_at': datetime.datetime.now(), 'teams': teams, 'version': VERSION, 'authenticated': kardboard.auth.is_authenticated(), } return render_template('team-backlog.html', **context)
def funnel(state_slug): states = States() try: state = states.find_by_slug(state_slug) funnel = Funnel(state, app.config.get('FUNNEL_VIEWS', {})[state]) except KeyError: abort(404) cards = funnel.ordered_cards() funnel_auth = False if kardboard.auth.is_authenticated() is True: funnel_auth = funnel.is_authorized(session.get('username', '')) if request.method == "POST": if kardboard.auth.is_authenticated() is False or funnel_auth is False: abort(403) start = time.time() card_key_list = request.form.getlist('card[]') counter = 1 for card_key in card_key_list: Kard.objects( key=card_key.strip() ).only('priority').update_one(set__priority=counter) counter += 1 elapsed = (time.time() - start) return jsonify(message="Reordered %s cards in %.2fs" % (counter, elapsed)) title = "%s: All boards" % state funnel_markers = funnel.markers() context = { 'title': title.replace("Backlog", "Ready: Elabo").replace("OTIS", "TIE"), 'state': state, 'state_slug': state_slug, 'cards': cards, 'times_in_state': funnel.times_in_state(), 'funnel_throughput': funnel.throughput, 'funnel_markers': funnel_markers, 'funnel_auth': funnel_auth, 'updated_at': datetime.datetime.now(), 'version': VERSION, 'authenticated': kardboard.auth.is_authenticated(), } return render_template('funnel.html', **context)
def team_backlog(team_slug=None): if request.method == "POST": if kardboard.auth.is_authenticated() is False: abort(403) start = time.time() card_key_list = request.form.getlist('card[]') counter = 1 for card_key in card_key_list: Kard.objects( key=card_key.strip() ).only('priority').update_one(set__priority=counter) counter += 1 elapsed = (time.time() - start) return jsonify(message="Reordered %s cards in %.2fs" % (counter, elapsed)) teams = _get_teams() team = _find_team_by_slug(team_slug, teams) weeks = 4 backlog = Kard.objects.filter( team=team.name, state=States().backlog, ).exclude('_ticket_system_data').order_by('priority') backlog_marker_data, backlog_markers = _team_backlog_markers(team, backlog, weeks) backlog_without_order = [k for k in backlog if k.priority is None] backlog_with_order = [k for k in backlog if k.priority is not None] backlog_with_order.sort(key=lambda k: k.priority) backlog = backlog_with_order + backlog_without_order title = "%s" % team.name context = { 'title': title, 'team_slug': team_slug, 'team': team, 'backlog': backlog, 'backlog_markers': backlog_markers, 'backlog_marker_data': backlog_marker_data, 'updated_at': datetime.datetime.now(), 'teams': teams, 'version': VERSION, 'authenticated': kardboard.auth.is_authenticated(), } return render_template('team-backlog.html', **context)
def funnel(state_slug): states = States() try: state = states.find_by_slug(state_slug) funnel = Funnel(state, app.config.get("FUNNEL_VIEWS", {})[state]) except KeyError: abort(404) cards = funnel.ordered_cards() funnel_auth = False if kardboard.auth.is_authenticated() is True: funnel_auth = funnel.is_authorized(session.get("username", "")) if request.method == "POST": if kardboard.auth.is_authenticated() is False or funnel_auth is False: abort(403) start = time.time() card_key_list = request.form.getlist("card[]") counter = 1 for card_key in card_key_list: Kard.objects(key=card_key.strip()).only("priority").update_one(set__priority=counter) counter += 1 elapsed = time.time() - start return jsonify(message="Reordered %s cards in %.2fs" % (counter, elapsed)) title = "%s: All boards" % state funnel_markers = funnel.markers() context = { "title": title, "state": state, "state_slug": state_slug, "cards": cards, "times_in_state": funnel.times_in_state(), "funnel_throughput": funnel.throughput, "funnel_markers": funnel_markers, "funnel_auth": funnel_auth, "updated_at": datetime.datetime.now(), "version": VERSION, "authenticated": kardboard.auth.is_authenticated(), } return render_template("funnel.html", **context)
def team_backlog(team_slug=None): if request.method == "POST": if kardboard.auth.is_authenticated() is False: abort(403) start = time.time() card_key_list = request.form.getlist("card[]") counter = 1 for card_key in card_key_list: Kard.objects(key=card_key.strip()).only("priority").update_one(set__priority=counter) counter += 1 elapsed = time.time() - start return jsonify(message="Reordered %s cards in %.2fs" % (counter, elapsed)) teams = _get_teams() team = _find_team_by_slug(team_slug, teams) weeks = 12 backlog = ( Kard.objects.filter(team=team.name, state=States().backlog).exclude("_ticket_system_data").order_by("priority") ) backlog_marker_data, backlog_markers = _team_backlog_markers(team, backlog, weeks) title = "%s backlog" % team.name context = { "title": title, "team_slug": team_slug, "team": team, "backlog": backlog, "backlog_markers": backlog_markers, "backlog_marker_data": backlog_marker_data, "updated_at": datetime.datetime.now(), "teams": teams, "version": VERSION, "authenticated": kardboard.auth.is_authenticated(), } return render_template("team-backlog.html", **context)
def blocked(group="all", months=3, start=None): start = start or datetime.datetime.today() months_ranges = month_ranges(start, months) start = months_ranges[0][0] end = months_ranges[-1][-1] rg = ReportGroup(group, Kard.objects()) blocked_cards = rg.queryset blocked_cards = blocked_cards.filter(start_date__gte=start, start_date__lte=end, blocked_ever=True).order_by('-start_date') context = { 'title': "Blocked", 'cards': blocked_cards, 'start': start, 'end': end, 'updated_at': datetime.datetime.now(), 'version': VERSION, } return render_template('blocked.html', **context)
def blocked(group="all", months=3, start=None): start = start or datetime.datetime.today() months_ranges = month_ranges(start, months) start = months_ranges[0][0] end = months_ranges[-1][-1] rg = ReportGroup(group, Kard.objects()) blocked_cards = rg.queryset blocked_cards = blocked_cards.filter( start_date__gte=start, start_date__lte=end, blocked_ever=True).order_by('-start_date') context = { 'title': "Blocked", 'cards': blocked_cards, 'start': start, 'end': end, 'updated_at': datetime.datetime.now(), 'version': VERSION, } return render_template('blocked.html', **context)