Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
oss
gitlabtime
Commits
90b08603
Commit
90b08603
authored
Aug 04, 2020
by
Thomas Lotze
Browse files
re
#11
: don't collect time copied from another issue by moving between projects
parent
0794f2c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/gitlabtime/fetch.py
View file @
90b08603
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment