diff --git a/util/importer.py b/util/importer.py index 8e02b4382d2a0d6d8584c969dcc2cd6814a32716..8a6c4a37b465b779656f517c7f033097f611c026 100644 --- a/util/importer.py +++ b/util/importer.py @@ -1,6 +1,7 @@ import json import os import readline +import logging from util.messages import warn from core.models import ExamType, Feedback, Submission, SubmissionType, Test @@ -9,6 +10,8 @@ from util.factories import GradyUserFactory import semver +log = logging.getLogger(__name__) + WELCOME = r''' ______ __ ____ __ @@ -125,7 +128,10 @@ def load_hektor_json(): exam, _ = ExamType.objects.get_or_create(**exam_data['module']) for submission_type in exam_data['submission_types']: - SubmissionType.objects.get_or_create(**submission_type) + _, created = SubmissionType.objects.update_or_create( + name=submission_type['name'], defaults=submission_type) + if not created: + log.warning(f"Updated submission type {submission_type}") for student in exam_data['students']: student_obj = user_factory.make_student(exam=exam,