diff --git a/python/arbeitsstundenzettel.py b/python/arbeitsstundenzettel.py index 268a1ce0a0b03e03d70ffd9b8bdf1d4a00cce8d3..efa97a4d96c400a74f9c8cdd3436f418e191441e 100644 --- a/python/arbeitsstundenzettel.py +++ b/python/arbeitsstundenzettel.py @@ -29,11 +29,6 @@ def diff_full_months(start, end): def diff_months(start, end): - # TODO Question: Why? Answer: Everything in this script is about - # differences, which are only right if we add one day to the end date. - end = end + dt.timedelta(days=1) - # TODO Task: Check wether this always works or wether it yields problems - # for start.day > end.day. Answer: Pretty sure it does work everytime. months = (end.year - start.year) * 12 + end.month - start.month + 1 return months @@ -600,14 +595,16 @@ if filename == '': made_up = make_up_workinghours(2, start, end, workhours_per_week, workdays_per_week) workinghours.append(made_up) - for m in range(int(diff_months(start,end) + 0.5)): + for m in range(int(sp.ceil(diff_months(start,end)))): month = (start.month + m - 1) % 12 + 1 monthname = cal.month_name[month] + + print(month) entries = [day for day in workinghours[0] if day[0].month == month] entries.sort() - + year = entries[0][0].year total = 0