#!/usr/bin/env python3 import cgitb; cgitb.enable() import config import points def main(): s = points.Storage() teams = s.teams() categories = [(cat, s.cat_points(cat)) for cat in s.categories()] teamcolors = points.colors(teams) print('Content-type: text/html') print() print(''' CTF Scoreboard

Scoreboard

''' % config.base_url) print('') print('') for cat, score in categories: print('' % (cat, score)) print('') print('') for cat, total in categories: print('') print('') print('''
%s (%d)
') scores = sorted([(s.team_points_in_cat(cat, team), team) for team in teams]) for score, team in scores: color = teamcolors[team] print('
' % (float(score * 100)/total, color)) print(' %s: %d' % (cat, team, score)) print('
') print('
''') if __name__ == '__main__': main() # Local Variables: # mode: python # End: