diff options
-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) |