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

add(moodle): avoid duplicate searches in bulk-upload

parent da1222ba
Branches
No related tags found
No related merge requests found
......@@ -147,11 +147,17 @@ cookies = get_moodle_cookies()
info = get_enrol_info(cookies, url)
with open(students_file) as f:
done = set()
for line in f:
search = line.strip()
if len(search) == 0:
continue
# avoid duplicates since search results exclude enrolled users
if search in done:
continue
done.add(search)
student = get_user(cookies, info, search)
if student is None:
print(f"WARNING: no hit for {search}, ignoring.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment