From 5df7df2a498192e21cedc712fa49e4297c179b12 Mon Sep 17 00:00:00 2001
From: Dominik Seeger <dominik.seeger@gmx.net>
Date: Sat, 12 Oct 2019 16:58:17 +0200
Subject: [PATCH] tests are now created when importing via the frontend

---
 core/models/feedback.py | 20 --------------------
 util/importer.py        | 12 +++---------
 2 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/core/models/feedback.py b/core/models/feedback.py
index 742f9428..ec36f63b 100644
--- a/core/models/feedback.py
+++ b/core/models/feedback.py
@@ -41,26 +41,6 @@ class Feedback(models.Model):
     # the denominators that are allowed for the decimal score interpreted as a fraction
     ALLOWED_DENOMINATORS = [1, 2]
 
-    # how was this feedback created
-    (
-        WAS_EMPTY,
-        FAILED_UNIT_TESTS,
-        DID_NOT_COMPILE,
-        COULD_NOT_LINK,
-        MANUAL,
-    ) = range(5)
-    ORIGIN = (
-        (WAS_EMPTY, 'was empty'),
-        (FAILED_UNIT_TESTS, 'passed unittests'),
-        (DID_NOT_COMPILE, 'did not compile'),
-        (COULD_NOT_LINK, 'could not link'),
-        (MANUAL, 'created by a human. yak!'),
-    )
-    origin = models.IntegerField(
-        choices=ORIGIN,
-        default=MANUAL,
-    )
-
     class Meta:
         verbose_name = "Feedback"
         verbose_name_plural = "Feedback Set"
diff --git a/util/importer.py b/util/importer.py
index 21fa74e7..c1ee4356 100644
--- a/util/importer.py
+++ b/util/importer.py
@@ -34,19 +34,14 @@ RUSTY_HEKTOR_MAX_VER = "<5.0.0"
 
 valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}
 
-
-ORIGIN_ORDER = {
-    Feedback.WAS_EMPTY,
-    Feedback.DID_NOT_COMPILE,
-}
-
+# the camel-case entries are here for the import via frontend functionality.
 TEST_ORDER = (
     'EmptyTest',
+    '_empty_test',
     'CompileTest',
+    '_compile_test',
 )
 
-FEEDBACK_MAPPER = dict(zip(TEST_ORDER, ORIGIN_ORDER))
-
 user_factory = GradyUserFactory()
 
 
@@ -199,7 +194,6 @@ def add_feedback_if_test_recommends_it(test_obj):
             of_submission=test_obj.submission,
             defaults={
                 'score': 0,
-                'origin': FEEDBACK_MAPPER[test_obj.name],
                 'is_final': True,
             }
         )
-- 
GitLab