]> projects.mako.cc - iron-blogger/commitdiff
Script to print the results for a given week
authorNelson Elhage <nelhage@mit.edu>
Mon, 28 Dec 2009 23:18:14 +0000 (18:18 -0500)
committerNelson Elhage <nelhage@mit.edu>
Mon, 28 Dec 2009 23:18:14 +0000 (18:18 -0500)
show-week.py [new file with mode: 0644]

diff --git a/show-week.py b/show-week.py
new file mode 100644 (file)
index 0000000..a21f14c
--- /dev/null
@@ -0,0 +1,28 @@
+import yaml
+from dateutil.parser import parse
+import datetime
+import dateutil.tz as tz
+import sys
+
+START = datetime.datetime(2009, 12, 21, 6)
+
+with open('report.yml') as r:
+    report = yaml.safe_load(r)
+
+with open('bloggers.yml') as f:
+    users = yaml.safe_load(f)
+
+week = (parse(sys.argv[1], default=START) - START).days / 7
+week_start = START + (week * datetime.timedelta(7))
+week_end   = START + ((week + 1) * datetime.timedelta(7))
+
+
+for (name, weeks) in report.items():
+    user_start = parse(users[name]['start'], default=START)
+    if user_start > week_start:
+        print "SKIP %s" % (name,)
+        continue
+    elif len(weeks) <= week or not weeks[week]:
+        print "LAME %s" % (name,)
+    else:
+        print "OK %s" % (name,)

Benjamin Mako Hill || Want to submit a patch?