Skip to content
Snippets Groups Projects
Commit 12169637 authored by ayeaye's avatar ayeaye
Browse files

Group issues by parent

parent 6783160a
No related merge requests found
......@@ -83,6 +83,7 @@ def makeIssue(issue, isMilestone = False):
pOpen = 1,
labels = labels,
msType = int(isMilestone),
hasSubs = False,
)
if isMilestone:
......@@ -110,7 +111,7 @@ def makeIssue(issue, isMilestone = False):
if isParent:
itemObj.pGroup = 1
itemObj.pOpen = 0
itemObj.hasSubs = True
ispar = True
else:
itemObj.pParent = j.id
......@@ -142,7 +143,20 @@ def gantt(pid):
except gitlab.exceptions.GitlabListError:
issues = projgantt( gl.projects.get(pid, lazy=True) )
si = sorted([x for x in issues if x.msType], key = lambda x: x.pStart+x.pEnd)
idict = {i.pID: i for i in issues}
def makeSortKey(i):
if i.pParent and idict[i.pParent].hasSubs:
makeSortKey(idict[i.pParent])
i.sortKey = idict[i.pParent].sortKey
else:
i.sortKey = ""
i.sortKey += "--".join((i.pStart, i.pEnd, repr(i.pID)))
for i in issues:
makeSortKey(i)
si = sorted([x for x in issues if x.msType], key=lambda i : i.sortKey)
pStart = min([x.pStart for x in si if x.pStart != "None"] or ["None"])
pEnd = max([x.pEnd for x in si if x.pEnd != "None"] or ["None"])
......@@ -161,7 +175,7 @@ def gantt(pid):
for eid, epic in set(((x.eid or -1, x.epic or "Tasks not assigned to a subsystem")
for x in issues
if not x.msType)):
iss = sorted((x for x in issues if (x.eid or -1) == eid and not x.msType), key = lambda x: x.pStart+x.pEnd)
iss = sorted((x for x in issues if (x.eid or -1) == eid and not x.msType), key = lambda x: x.sortKey)
pStart = min([x.pStart for x in iss if x.pStart != "None"] or ["None"])
pEnd = max([x.pEnd for x in iss if x.pEnd != "None"] or ["None"])
eio = Dict(
......
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