diff options
author | Markus Krogh <markus@nordu.net> | 2017-07-15 00:04:38 +0200 |
---|---|---|
committer | Markus Krogh <markus@nordu.net> | 2017-07-15 00:06:32 +0200 |
commit | 3062d98f2c0db4d37953fdacc3f68f51572958b0 (patch) | |
tree | 8c04cdc61463ce49f79730270506922d44fdcca8 /maconomy/utils.py | |
parent | 00261b50a38dd07b6b561c80673c6f8938f7136a (diff) |
MSSQL support
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) |