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
2f79c5f6
Commit
2f79c5f6
authored
Aug 02, 2020
by
Thomas Lotze
Browse files
fix parsing of times in tracking notes
parent
d2bfba4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/gitlabtime/fetch.py
View file @
2f79c5f6
...
...
@@ -3,8 +3,13 @@ from gitlab import Gitlab
def
parse_action
(
action
):
op
,
time_str
=
action
.
split
()
op
,
time_str
=
action
.
split
(
None
,
1
)
sign
=
dict
(
added
=
1
,
subtracted
=-
1
)[
op
]
value
=
sum
(
parse_time
(
piece
)
for
piece
in
time_str
.
split
())
return
sign
*
value
def
parse_time
(
time_str
):
ulen
=
2
if
time_str
.
endswith
(
'mo'
)
else
1
value_str
,
unit_str
=
time_str
[:
-
ulen
],
time_str
[
-
ulen
:]
unit
=
dict
(
...
...
@@ -15,7 +20,7 @@ def parse_action(action):
m
=
60
,
s
=
1
,
)[
unit_str
]
return
sign
*
float
(
value_str
)
*
unit
return
float
(
value_str
)
*
unit
def
fetch
(
url
,
token
):
...
...
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