#!/usr/bin/env python3 import cgitb; cgitb.enable() import os import sys from . import config from . import teams from . import points flags_dir = config.get('global', 'flags_dir') house_team = config.get('global', 'house_team') def main(): s = points.Storage() categories = [(cat, s.cat_points(cat)) for cat in s.categories()] print('Content-type: text/html') print('Refresh: 10') print() print(''' Scoreboard

Scoreboard

''' % config.base_url) print('') print('') print('') for cat, score in categories: print('') print('') print('') print('') for cat, total in categories: print('') print('') print('''
Overall') print(' %s (%d)' % (cat, score)) try: fn = os.path.join(flags_dir, cat) team = open(fn).read() or house_team print('
') print(' %s' % (cat, teams.color(team), team)) except IOError: pass print('
    ') totals = [] for team in s.teams: total = s.team_points(team) totals.append((total, team)) for total, team in sorted(totals, reverse=True): print('
  1. %s (%0.3f)
  2. ' % (teams.color(team), team, total)) print('
') scores = sorted([(s.team_points_in_cat(cat, team), team) for team in s.teams]) for score, team in scores: color = teams.color(team) print('
' % (float(score * 100)/total, color)) print(' %s: %d' % (cat, team, score)) print('
') print('

scores over time

''') if __name__ == '__main__': main() # Local Variables: # mode: python # End: