diff options
author | Alasdair Colley <ac@brede.(none)> | 2011-11-01 18:02:18 +0000 |
---|---|---|
committer | Alasdair Colley <ac@brede.(none)> | 2011-11-01 18:02:18 +0000 |
commit | 319fbf5ecd744d6a1fbe0ce4e219823132f29262 (patch) | |
tree | f72e25e8a0fb179530d8325c2ccce78ffdb3cc6a | |
parent | 92e32d4373edae96871811d8f048e2de0722495a (diff) |
add event LATER
-rwxr-xr-x | perc | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -40,6 +40,7 @@ import copy import decimal import json import optparse +import random import re import string import sys @@ -76,7 +77,7 @@ WEEK_LENGTH = 7 WEEKEND = [ SATURDAY, SUNDAY ] WORK_WEEK = [ MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY ] -IMPORTANT_TEMPORAL_EVENTS = ["tomorrow", "friday", "new year", "newyear", "christmas", "xmas", "weekend", "midday", "noon", "lunch", "easter", "halloween"] +IMPORTANT_TEMPORAL_EVENTS = ["LATER", "tomorrow", "friday", "new year", "newyear", "christmas", "xmas", "weekend", "midday", "noon", "lunch", "easter", "halloween"] OUTPUT_TYPES = ["perc", "bar", "ram", "pint"] @@ -193,7 +194,13 @@ def getDayOfWeek(day): def parseTemporalEvent(event, user): start, finish = None, None - if event == "tomorrow": + if event == "LATER": + start = NOW - timedelta(minutes=random.randint(1, 400)) + finish = NOW + timedelta(minutes=random.randint(1, 400)) + + start_formatted = start.strftime("%H:%M") + finish_formatted = finish.strftime("%H:%M") + elif event == "tomorrow": start = NOW.replace(hour=0, minute=0, second=0, microsecond=0) finish = NOW.replace(day=NOW.day + 1, hour=0, minute=0, second=0, microsecond=0) |