1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-19 18:31:16 +00:00

Warn instead of exception

This commit is contained in:
Mo 2022-09-10 18:26:46 +02:00
parent c78491f61c
commit 13012d6a97

View file

@ -201,16 +201,19 @@ def importFromFile(filePath: Path):
else: else:
# Check if columns that should not change match # Check if columns that should not change match
if dbStudent.first_name != first_name: if dbStudent.first_name != first_name:
raise DataBaseImportException( flash(
f"First name {dbStudent.first_name} in the database does not match with the first name {first_name} provided in the import file for the student number {student_number}. In case the name is changed, please change it manually using the web interface first." f'First name "{dbStudent.first_name}" in the database does not match with the first name "{first_name}" provided in the import file for the student number {student_number}.',
"warning",
) )
if dbStudent.last_name != last_name: if dbStudent.last_name != last_name:
raise DataBaseImportException( flash(
f"Last name {dbStudent.last_name} in the database does not match with the last name {last_name} provided in the import file for the student number {student_number}. In case the name is changed, please change it manually using the web interface first." f'Last name "{dbStudent.last_name}" in the database does not match with the last name "{last_name}" provided in the import file for the student number {student_number}.',
"warning",
) )
if dbStudent.uni_email != uni_email: if dbStudent.uni_email != uni_email:
raise DataBaseImportException( flash(
f"University email {dbStudent.uni_email} in the database does not match with the university email {last_name} provided in the import file for the student number {student_number}. In case the email is changed, please change it manually using the web interface first." f'University email "{dbStudent.uni_email}" in the database does not match with the university email "{last_name}" provided in the import file for the student number {student_number}.',
"warning",
) )
dbStudent.contact_email = contact_email dbStudent.contact_email = contact_email