diff --git a/src/scoreboard b/src/scoreboard
index dab44c8..cfa9b72 100755
--- a/src/scoreboard
+++ b/src/scoreboard
@@ -1,5 +1,11 @@
#! /usr/bin/awk -f
+##
+##
+## I'm not happy with how this code looks. I've
+##
+##
+
function qsort(A, left, right, i, last) {
if (left >= right)
return
@@ -23,6 +29,20 @@ function escape(s) {
return s
}
+function print_bar(cat, team, n, d) {
+ printf("
\n" \
+ " %s: %.2f\n" \
+ "
",
+ team,
+ 100 * n / d,
+ team,
+ team,
+ cat, escape(names_by_team[team]), n)
+}
+
function output( t, c) {
for (t in teams) {
score = 0;
@@ -56,7 +76,7 @@ BEGIN {
colors[8] = "8db6cd"
ncolors = 9
- # Every 2.5 minutes
+ # New point at least every 2.5 minutes
interval = 150
tslen = 0
@@ -94,45 +114,6 @@ BEGIN {
close(fn)
}
- # Get team names
-
- width = lasttime - start
- print ""
- print ""
- print " "
- print " foo"
- print " "
- print " "
- print " "
- print " "
- print " "
- print " "
- print "
Scoreboard
"
- print "
"
- print "
Overall
"
-
# Sort categories
ncats = 0
for (cat in points_by_cat) {
@@ -140,19 +121,6 @@ BEGIN {
}
qsort(cats, 0, ncats-1)
- # Print out category names
- for (i = 0; i < ncats; i += 1) {
- cat = cats[i]
- points = points_by_cat[cat]
- if (0 == points) continue
- printf("
%s (%d)
\n", cat, points)
- }
- print "
"
-
- print "
"
- print "
"
- print " "
-
# Create a sorted list of scores
nteams = 0
for (team in teams) {
@@ -160,21 +128,77 @@ BEGIN {
}
qsort(scores, 0, nteams-1)
+
+ # Now we can start writing the document
+ print ""
+ print ""
+ print " "
+ print " Scoreboard"
+ print " "
+ print " "
+
+ # Provide raw data for the chart
+ print " "
+
+ # Set up team colors
+ print " "
+
+ print " "
+ print " "
+ print "
Scoreboard
"
+ print ""
+ print "
"
+ print "
"
+ print "
Overall
"
+
+ # Print out category names
+ for (i = 0; i < ncats; i += 1) {
+ cat = cats[i]
+ points = points_by_cat[cat]
+ if (0 == points) continue
+ printf("
%s (%d)
\n", cat, points)
+ }
+
+ print "
"
+ print "
"
+
# Print out teams, ranked by score
- bottom = nteams - 10
- if (bottom < 0) bottom = 0
- for (i = nteams-1; i >= bottom; i -= 1) {
+ print "
"
+ for (i = 0; i < nteams; i += 1) {
if (scores[i] == scores[i-1]) continue;
for (team in teams) {
if (scores[i] == scores_by_team_time[team, lasttime]) {
name = names_by_team[team]
- printf("