diff --git a/moodle/create-groups.py b/moodle/create-groups.py index bfc52d3f398cf885147b1976e96a6bd586c985f9..091b824e5dee2c151e9736473c3baae281a6ff6a 100644 --- a/moodle/create-groups.py +++ b/moodle/create-groups.py @@ -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: