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

Small change to importer script, warns if submission type is changed

parent cf75b332
Branches
Tags
1 merge request!164Resolve "Update test data to incorporate changes to data format and importer"
Pipeline #95429 passed
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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment