diff --git a/util/importer.py b/util/importer.py index d72f487801495452dd27182cca4f486c560bf62e..8e02b4382d2a0d6d8584c969dcc2cd6814a32716 100644 --- a/util/importer.py +++ b/util/importer.py @@ -1,7 +1,6 @@ import json import os import readline -import util from util.messages import warn from core.models import ExamType, Feedback, Submission, SubmissionType, Test @@ -35,15 +34,11 @@ valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False} ORIGIN_ORDER = { Feedback.WAS_EMPTY, Feedback.DID_NOT_COMPILE, - Feedback.COULD_NOT_LINK, - Feedback.FAILED_UNIT_TESTS, } TEST_ORDER = ( - util.processing.EmptyTest.__name__, - util.processing.CompileTest.__name__, - util.processing.LinkTest.__name__, - util.processing.UnitTestTest.__name__, + 'EmptyTest', + 'CompileTest', ) FEEDBACK_MAPPER = dict(zip(TEST_ORDER, ORIGIN_ORDER)) @@ -129,7 +124,7 @@ def load_hektor_json(): exam, _ = ExamType.objects.get_or_create(**exam_data['module']) - for submission_type in exam['submission_types']: + for submission_type in exam_data['submission_types']: SubmissionType.objects.get_or_create(**submission_type) for student in exam_data['students']: @@ -183,12 +178,9 @@ def add_tests(submission_obj, tests): def add_feedback_if_test_recommends_it(test_obj): - available_tests = util.processing.Test.available_tests() - - if test_obj.label == available_tests[test_obj.name].label_failure \ - and not hasattr(test_obj.submission, 'feedback') \ - and (test_obj.name == util.processing.EmptyTest.__name__ or - test_obj.name == util.processing.CompileTest.__name__): + # TODO rework this brittle code + if (test_obj.label == 'EMPTY' or test_obj.label == 'COMPILATION_FAILED') \ + and not hasattr(test_obj.submission, 'feedback'): return Feedback.objects.update_or_create( of_submission=test_obj.submission, defaults={