diff options
Diffstat (limited to 'maconomy/utils.py')
-rw-r--r-- | maconomy/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/maconomy/utils.py b/maconomy/utils.py index 3cfeb2d..de5ccdd 100644 --- a/maconomy/utils.py +++ b/maconomy/utils.py @@ -1,4 +1,6 @@ from collections import defaultdict +import datetime + def per_manager(timesheets): per_manager = defaultdict(list) @@ -8,5 +10,11 @@ def per_manager(timesheets): per_manager[manager_id].append(timesheet) return per_manager + def employees(timesheets): return dict([(t.employee.id, t.employee) for t in timesheets]) + + +def previous_monday(date=None): + today = date or datetime.date.today() + return today + datetime.timedelta(days=-today.weekday(), weeks=-1) |