Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
IDATT2900-072
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mattias Agentoft Eggen
IDATT2900-072
Commits
7d2a0bd6
Commit
7d2a0bd6
authored
2 years ago
by
williamforbrigd
Browse files
Options
Downloads
Patches
Plain Diff
tryngdsaf
parent
07326030
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bbcli/endpoints.py
+10
-3
10 additions, 3 deletions
bbcli/endpoints.py
with
10 additions
and
3 deletions
bbcli/endpoints.py
+
10
−
3
View file @
7d2a0bd6
...
...
@@ -86,7 +86,7 @@ def get_course_contents(course_id: str):
click
.
echo
(
map
)
def
get_children
(
session
,
worklist
,
url
,
acc
,
count
:
int
=
0
,
is_root
=
True
):
def
get_children
(
session
,
worklist
,
url
,
acc
,
count
:
int
=
0
):
count
=
count
+
1
key
=
'
hasChildren
'
if
len
(
worklist
)
==
0
:
...
...
@@ -94,10 +94,14 @@ def get_children(session, worklist, url, acc, count: int = 0, is_root = True):
else
:
node
=
worklist
.
pop
()
id
=
node
.
data
[
'
id
'
]
if
is_root
is
False
:
if
'
parentId
'
in
node
.
data
:
old
=
f
'
{
url
}
/children
'
else
:
old
=
f
'
{
url
}
/
{
id
}
/children
'
# if is_root is False:
# old = f'{url}/children'
# else:
# old = f'{url}/{id}/children'
response
=
session
.
get
(
old
,
cookies
=
cli
.
cookies
)
if
check_response
(
response
)
==
False
:
return
acc
...
...
@@ -184,7 +188,7 @@ def get_assignments(course_id: str, folder_id=None):
# print(len(data))
root
=
Node
(
data
,
True
)
worklist
=
[
root
]
res
=
get_children
(
session
,
worklist
,
url
,
[]
,
is_root
=
False
)
res
=
get_children
(
session
,
worklist
,
url
,
[])
create_tree
(
root
,
res
)
else
:
data
=
response
.
json
()[
'
results
'
]
...
...
@@ -192,6 +196,9 @@ def get_assignments(course_id: str, folder_id=None):
root
=
Node
(
root
,
True
)
worklist
=
[
root
]
res
=
get_children
(
session
,
worklist
,
url
,
[])
# for r in res:
# print()
# print(r.data['title'])
create_tree
(
root
,
res
)
end
=
time
.
time
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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