Skip to content
Snippets Groups Projects
Commit 0e5d0bd7 authored by Hague Matthew UXAC009's avatar Hague Matthew UXAC009
Browse files

add(moodle): add output to new create groups script

parent 226ccce4
Branches
No related tags found
No related merge requests found
......@@ -66,9 +66,9 @@ class Moodle:
"""Gets current moodle cookies from firefox"""
cookie_jar = browser_cookie3.firefox(domain_name=MOODLE_DOMAIN)
cookies = {
c.name : str(c.value)
c.name : c.value
for c in cookie_jar
if c.name == MOODLE_SESSION_COOKIE
if c.name == MOODLE_SESSION_COOKIE and c.value is not None
}
if len(cookies) == 0:
......@@ -132,6 +132,7 @@ class GroupCreator:
def _create_moodle_group(self, group : str):
"""Create a new Moodle group with given group name"""
print(f"Creating group {group}")
self.moodle.post_data(
CREATE_GROUP_URL,
{
......@@ -156,6 +157,8 @@ class GroupCreator:
def _add_students_to_group(self, name : str, students : Set[str]):
"""Group name must exist, add students emails to it"""
print(f"Adding students to {name}")
if name not in self.groups_info.groups:
print(f"Unknown group {name}, ignoring.")
return
......@@ -179,6 +182,8 @@ class GroupCreator:
)
]
print(f"Adding {todo}")
todo_ids = list()
# get selector id for searching users
......@@ -218,7 +223,6 @@ class GroupCreator:
"userselector_searchanywhere" : "true"
}
).json()["results"]
print(results)
if len(results) != 1:
return None
elif len(results[0]["users"]) != 1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment