Commit 90b08603 authored by Thomas Lotze's avatar Thomas Lotze

re #11: don't collect time copied from another issue by moving between projects

parent 0794f2c1
......@@ -69,12 +69,16 @@ def fetch_issue(issue):
# containing a time-tracking quick action, an additional system note is
# created at that time, which either adds or subtracts time for an
# arbitrary date, or removes any previous time spent. Removal invalidates
# any tracking notes prior to its creation. Tracking done after the latest
# removal always applies, regardless of the date it applies to. Thus, we
# need to consider any and all time tracking done after the latest
# removal, which may track time for any date, in any order. We do this by
# iterating through notes backwards by creation date until we find a
# removal note.
# any tracking notes prior to its creation. Moving an issue to another
# project leaves time tracking valid on the original and invalidates all
# time-tracking notes copied to the new issue.
# Tracking done after the latest time removal or issue creation by moving
# ("moved from") always applies, regardless of the date it applies to.
# Thus, we need to consider any and all time tracking done after the
# latest removal or "move from", which may track time for any date, in any
# order. We do this by iterating through notes backwards by creation date
# until we find a removal or "move from" note.
notes = issue.notes.list(
all=True, order_by='created_at', sort='desc')
......@@ -84,6 +88,8 @@ def fetch_issue(issue):
continue
if note.body == 'removed time spent':
break
if note.body.startswith('moved from '):
break
sep = ' of time spent at '
action, _, date = note.body.partition(sep)
......
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