Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gantt
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mehtank
gantt
Commits
6cc70dcc
Commit
6cc70dcc
authored
3 years ago
by
ayeaye
Browse files
Options
Downloads
Patches
Plain Diff
Refactor/cleanup issue attribute handling
parent
1efbbd90
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/gl/ganttify.py
+19
-18
19 additions, 18 deletions
app/gl/ganttify.py
with
19 additions
and
18 deletions
app/gl/ganttify.py
+
19
−
18
View file @
6cc70dcc
...
...
@@ -4,16 +4,14 @@ import logging
import
json
from
datetime
import
date
,
timedelta
from
addict
import
Dict
from
contextlib
import
suppress
SCRIPT_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
sys
.
path
.
append
(
SCRIPT_DIR
)
from
gl
import
*
def
makeIssue
(
issue
,
isMilestone
=
False
):
if
"
DELETED
"
in
issue
.
title
:
return
None
def
getDates
(
issue
,
isMilestone
=
False
):
# XXX TODO: What about issues without a due_date?
try
:
end
=
date
.
fromisoformat
(
issue
.
due_date
)
...
...
@@ -36,28 +34,31 @@ def makeIssue(issue, isMilestone = False):
else
:
start
=
None
comp
=
0
try
:
return
start
,
end
def
getComp
(
issue
):
with
suppress
(
AttributeError
):
if
issue
.
state
==
"
closed
"
:
comp
=
100
return
100
elif
issue
.
task_completion_status
[
"
count
"
]:
comp
=
100
*
issue
.
task_completion_status
[
"
completed_count
"
]
/
issue
.
task_completion_status
[
"
count
"
]
except
AttributeError
:
pass
return
100
*
issue
.
task_completion_status
[
"
completed_count
"
]
/
issue
.
task_completion_status
[
"
count
"
]
return
0
def
makeIssue
(
issue
,
isMilestone
=
False
):
if
"
DELETED
"
in
issue
.
title
:
return
None
start
,
end
=
getDates
(
issue
,
isMilestone
)
comp
=
getComp
(
issue
)
cls
=
isMilestone
and
"
ggroupblack
"
or
"
gtaskblue
"
who
=
""
try
:
who
=
"
,
"
.
join
((
x
[
"
name
"
]
for
x
in
issue
.
assignees
))
except
AttributeError
:
pass
with
suppress
(
AttributeError
):
who
=
"
,
"
.
join
((
x
[
"
name
"
]
for
x
in
issue
.
assignees
))
labels
=
''
try
:
labels
=
"
,
"
.
join
(
issue
.
labels
)
except
AttributeError
:
pass
with
suppress
(
AttributeError
):
labels
=
"
,
"
.
join
(
issue
.
labels
)
if
isMilestone
:
parent
=
0
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment