Skip to content
Snippets Groups Projects
Commit 8bdefb8c authored by Millian Poquet's avatar Millian Poquet
Browse files

moodle: check for some columns, not exact match

parent 2bdc233d
No related branches found
No related tags found
No related merge requests found
......@@ -15,8 +15,13 @@ def read_parse_participants(filename: str) -> pandas.DataFrame:
column_names = [str(x) for x in df.columns]
expected_column_names = ['Prénom', 'Nom', "Numéro d'identification", 'Adresse de courriel']
if column_names != expected_column_names:
raise RuntimeError(f"unexpected column names in moodle participant file '{filename}': got '{column_names}' while '{expected_column_names}' was expected")
missing_cols = list()
for col_name in expected_column_names:
if col_name not in column_names:
missing_cols.append(col_name)
if len(missing_cols) > 0:
raise RuntimeError(f"missing column names in moodle participant file '{filename}': '{missing_cols}'. got '{column_names}' while '{expected_column_names}' was expected")
df.rename(columns={
expected_column_names[0]: "moodle_firstname",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment