Skip to content
Snippets Groups Projects
Commit ddb373b6 authored by robinwilliam.hundt's avatar robinwilliam.hundt
Browse files

Fixed bug in anonymisation function

The function `do_anonymous` in `hektor.py` was dependant upon the iteration order of a dictionary being the same as the insertion order. This is an implementation detail of CPython3.6 and should not be relied upon.
parent 4faddf13
No related branches found
No related tags found
1 merge request!2Fixed bug in anonymisation function
...@@ -227,11 +227,11 @@ def do_anonymous(students: Dict[str, Union[str, List]]): ...@@ -227,11 +227,11 @@ def do_anonymous(students: Dict[str, Union[str, List]]):
reverser = {get_random_xkcd_identifier(): s for s in students} reverser = {get_random_xkcd_identifier(): s for s in students}
students_anonymous = [{ students_anonymous = [{
'fullname': ' '.join(w[0].capitalize() + w[1:] 'fullname': ' '.join(w[0].capitalize() + w[1:]
for w in r.split(DELIMITER)), for w in pseudo_identifier.split(DELIMITER)),
'identifier': r, 'identifier': pseudo_identifier,
'username': r, 'username': pseudo_identifier,
'submissions': student['submissions'] 'submissions': student['submissions']
} for r, student in zip(reverser, students)] } for pseudo_identifier, student in reverser.items()]
with open(args.personal_secret_table, 'w') as out: with open(args.personal_secret_table, 'w') as out:
print('key;previous identifier;fullname', file=out) print('key;previous identifier;fullname', file=out)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment