Commit f12b5346 authored by Thomas Lotze's avatar Thomas Lotze

re #2: use date type for date filters rather than compare strings

Also, since there is a default value for --month now, we don't need to
think about unset date filters.
parent 965d5686
......@@ -52,14 +52,16 @@ logging.basicConfig(format=logging.BASIC_FORMAT)
help='path to CSV output file',
)
def cli(url, token, month, start, end, group, project, username, csv):
if month:
first = month + '-01'
if not start:
start = first
if not end:
first = date.fromisoformat(first)
_, last = monthrange(first.year, first.month)
end = '{}-{}'.format(month, last)
first = date.fromisoformat(month + '-01')
if start:
start = date.fromisoformat(start)
else:
start = first
if end:
end = date.fromisoformat(end)
else:
_, last = monthrange(first.year, first.month)
end = date(first.year, first.month, last)
filter = dict(
start=start,
......
......@@ -56,9 +56,8 @@ def fetch_project(project, filter):
if filter['username'] not in (author, None):
continue
if (filter['start'] or '') > day:
continue
if (filter['end'] or '9999-99-99') < day:
day = date.fromisoformat(day)
if not (filter['start'] <= day <= filter['end']):
continue
entries[author, day] += seconds
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment