Exemple #1
0
def home():
    results = Team.get_all_rounds_results()
    team_data = {}
    # We start at one because that's how javascript expects the team_data
    current_index = 1
    for name in sorted(results['scores'].keys()):
        scores = results['scores'][name]
        rgb_color = results['rgb_colors'][name]
        team_data[current_index] = {
            "label": name,
            "data": scores,
            "color": rgb_color
        }
        current_index += 1

    team_labels = []
    team_scores = []
    scores_colors = []
    for blue_team in Team.get_all_blue_teams():
        team_labels.append(blue_team.name)
        team_scores.append(blue_team.current_score)
        scores_colors.append(blue_team.rgb_color)

    return render_template('scoreboard.html',
                           round_labels=results['rounds'],
                           team_data=team_data,
                           team_labels=team_labels,
                           team_scores=team_scores,
                           scores_colors=scores_colors)
Exemple #2
0
 def test_get_array_of_scores(self):
     populate_sample_data(self.session)
     results = Team.get_all_rounds_results()
     assert 'rounds' in results
     assert results['rounds'] == ['Round 0', 'Round 1', 'Round 2']
     assert 'rgb_colors' in results
     assert 'Blue Team 1' in results['rgb_colors']
     assert results['rgb_colors']['Blue Team 1'].startswith('rgba')
     assert 'scores' in results
     assert results['scores'] == {'Blue Team 1': [0, 100, 100]}
def scoreboard_get_line_data():
    results = Team.get_all_rounds_results()
    team_data = {'team': [], 'rounds': results['rounds']}
    if 'team_names' in results.keys():
        for team_name in results['team_names']:
            scores = results['scores'][team_name]
            rgb_color = results['rgb_colors'][team_name]
            team_data['team'].append({
                "name": team_name,
                "scores": scores,
                "color": rgb_color
            })
    return jsonify(team_data)
Exemple #4
0
def scoreboard_get_line_data():
    results = Team.get_all_rounds_results()
    team_data = {"team": [], "rounds": results["rounds"]}
    if "team_names" in results.keys():
        for team_name in results["team_names"]:
            scores = results["scores"][team_name]
            rgb_color = results["rgb_colors"][team_name]
            team_data["team"].append({
                "name": team_name,
                "scores": scores,
                "color": rgb_color
            })
    return jsonify(team_data)
Exemple #5
0
def scoreboard_get_bar_data():
    results = Team.get_all_rounds_results()
    team_data = {}

    team_labels = []
    team_scores = []
    scores_colors = []
    for blue_team in Team.get_all_blue_teams():
        team_labels.append(blue_team.name)
        team_scores.append(blue_team.current_score)
        scores_colors.append(blue_team.rgb_color)

    team_data['labels'] = team_labels
    team_data['scores'] = team_scores
    team_data['colors'] = scores_colors

    return jsonify(team_data)
Exemple #6
0
def scoreboard_get_line_data():
    results = Team.get_all_rounds_results()
    team_data = {}
    team_data['team'] = {}
    team_data['round'] = results['rounds']
    # We start at one because that's how javascript expects the team_data
    current_index = 1
    for name in sorted(results['scores'].keys()):
        scores = results['scores'][name]
        rgb_color = results['rgb_colors'][name]
        team_data['team'][current_index] = {
            "label": name,
            "data": scores,
            "color": rgb_color
        }
        current_index += 1

    return jsonify(team_data)