links:
- [Alex Dehnert's Blog, 'http://www.dehnerts.com/~alex/meta/news/', 'http://www.dehnerts.com/~alex/meta/news/?format=rss-full']
start: 12/21
+ skip: [[5/31/2010, 8/16/2010]]
afarrell:
end: 02/01/2010
links:
links:
- [cslink, 'http://cslink.scripts.mit.edu/blog/', 'http://cslink.scripts.mit.edu/blog/?feed=rss2']
start: 12/28
+ skip: [[5/31/2010, 9/6/2010]]
davidben:
links:
- [Apparently this installer wants a title, 'http://davidben.scripts.mit.edu/blog/',
'http://davidben.scripts.mit.edu/blog/feed/']
start: 02/15/2010
+ skip: [[5/31/2010, 8/30/2010]]
ezyang:
links:
- [Inside 245s, 'http://ezyang.scripts.mit.edu/blog/', 'http://ezyang.scripts.mit.edu/blog/feed/atom/']
kasittig:
links:
- [Wuthering Snow Mooncrash, 'http://kasittig.scripts.mit.edu/blog/', 'http://kasittig.scripts.mit.edu/blog/?feed=rss2']
- skip: [3/15/2010]
+ skip: [3/15/2010, [5/31/2010, 8/23/2010]]
start: 12/21
kcr:
links:
- [PiPER, 'http://wings.scripts.mit.edu/blog/', 'http://wings.scripts.mit.edu/blog/feed/']
- [panscience, 'http://wings.mit.edu/blog/', 'http://wings.mit.edu/blog/feed/']
start: 12/21
+ skip: [[5/31/2010, 9/6/2010]]
xavid:
links:
- [Fireflies Sing, 'http://fireflies.xavid.us/', 'http://fireflies.xavid.us/feed/atom/']
debts.append((user, val))
return debts
+def to_week_num(date):
+ return (parse(date, default=START) - START).days / 7
+
+def parse_skip(rec):
+ spec = rec.get('skip', [])
+ out = []
+ for s in spec:
+ if isinstance(s, list):
+ out.append(map(to_week_num, s))
+ else:
+ out.append(to_week_num(s))
+ return out
+
+def should_skip(skips, week):
+ for e in skips:
+ if e == week:
+ return True
+ if isinstance(e, list) and e[0] <= week and e[1] > week:
+ return True
+ return False
+
def render_template(path, week=None, **kwargs):
with open('out/report.yml') as r:
report = yaml.safe_load(r)
u.links = rec['links']
u.start = rec['start']
u.end = rec.get('end')
- u.skip = [(parse(x, default=START) - START).days / 7
- for x in rec.get('skip', [])]
+ u.skip = parse_skip(rec)
u.weeks = report.get(un, [])
userlist.append(u)
if u.end and parse(u.end, default=START) <= week_start:
continue
- if week in u.skip:
+ if should_skip(u.skip, week):
pass
elif user_start > week_start:
skip.append(u)