From 135aa8461150fd0e7a2e8b53756d153f682bf5f4 Mon Sep 17 00:00:00 2001
From: Tue Herlau <tuhe@dtu.dk>
Date: Sat, 28 May 2022 21:07:46 +0200
Subject: [PATCH] updates

---
 .../instructor/cs102_autolab/report2.py       |  2 ++
 src/unitgrade_private/autolab/autolab.py      | 25 ++++---------------
 src/unitgrade_private/hidden_create_files.py  |  9 +++----
 3 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/examples/autolab_example_py_upload/instructor/cs102_autolab/report2.py b/examples/autolab_example_py_upload/instructor/cs102_autolab/report2.py
index bdf73d2..a1d3453 100644
--- a/examples/autolab_example_py_upload/instructor/cs102_autolab/report2.py
+++ b/examples/autolab_example_py_upload/instructor/cs102_autolab/report2.py
@@ -60,6 +60,8 @@ class Question2(UTestCase): #!s=c
 
 
 class Report2(Report):
+    version = 1.0
+    url = "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/tree/master/examples/autolab_example_py_upload/instructor/cs102_autolab"
     title = "CS 106a"
     questions = [(Week1, 10), (Week1Titles, 6)]
     pack_imports = [homework1]
diff --git a/src/unitgrade_private/autolab/autolab.py b/src/unitgrade_private/autolab/autolab.py
index 85c1ff2..ce13138 100644
--- a/src/unitgrade_private/autolab/autolab.py
+++ b/src/unitgrade_private/autolab/autolab.py
@@ -91,18 +91,6 @@ def new_deploy_assignment(base_name, INSTRUCTOR_REPORT_CLASS, INSTRUCTOR_BASE, I
     In case the students should not upload the token, we do something else. 
     But what? 
     """
-
-    # INSTRUCTOR_REPORT_CLASS.pack_imports
-    # report = INSTRUCTOR_REPORT_CLASS()
-
-    # INSTRUCTOR_REPORT_CLASS
-    # from unitgrade_private.deployment.deploy import setup
-    from unitgrade_private.hidden_create_files import setup_grade_file_report
-    # Don't give a shit about compression, but execute the report to get a valid token file.
-    # output = setup_grade_file_report(INSTRUCTOR_REPORT_CLASS, execute=False)
-
-    # deploy_assignment()
-    # deploy_directly = COURSES_BASE != None
     if COURSES_BASE == None:
         COURSES_BASE = os.getcwd() + "/../tmp"
         if not os.path.exists(COURSES_BASE):
@@ -123,18 +111,15 @@ def new_deploy_assignment(base_name, INSTRUCTOR_REPORT_CLASS, INSTRUCTOR_BASE, I
     # Now we have the instructor token file. Let's get the student token file.
     total_ = res['total'][1]
     problems = []
-    problems.append(dict(name='Unitgrade score', description='', max_score=total_, optional='false'))
-    print(problems)
+    problems.append(dict(name='Unitgrade score', description='Score obtained by automatic grading', max_score=total_, optional='false'))
+    problems.append(dict(name='Written feedback', description='Written (TA) feedback', max_score=0, optional='true'))
+    # print(problems)
     sc = [('Total', res['total'][0])] + [(q['title'], q['obtained']) for k, q in res['details'].items()]
     ss = ", ".join([f'"{t}": {s}' for t, s in sc])
     scores = '{"scores": {' + ss + '}}'
-    print(scores)
-    # Quickly make student .token file to upload:
-    # os.system(f"cd {os.path.dirname(STUDENT_HANDOUT_DIR)} && python -m programs.{os.path.basename(INSTRUCTOR_GRADE_FILE)[:-3]}")
-    # os.system(f"cd {STUDENT_HANDOUT_DIR} && python {os.path.basename(INSTRUCTOR_GRADE_FILE)}")
-    # handin_filename = os.path.basename(STUDENT_TOKEN_FILE)
+
     run_relative(STUDENT_GRADE_FILE, STUDENT_BASE)
-    # if student_should_upload_token:
+
     STUDENT_TOKEN_FILE = glob.glob(os.path.dirname(STUDENT_GRADE_FILE) + "/*.token")[0]
     handin_filename = os.path.basename(STUDENT_TOKEN_FILE)
     for _ in range(3):
diff --git a/src/unitgrade_private/hidden_create_files.py b/src/unitgrade_private/hidden_create_files.py
index 67e4695..2051f4f 100644
--- a/src/unitgrade_private/hidden_create_files.py
+++ b/src/unitgrade_private/hidden_create_files.py
@@ -51,8 +51,7 @@ def setup_grade_file_report(ReportClass, execute=False, obfuscate=False, minify=
     payload['config']['blake2b_file_hashes'] = known_hashes
     time.sleep(0.1)
     print("Packing student files...")
-    # pack report into a binary blob thingy the students can run on their own.
-    # report = ReportClass()
+
     fn = inspect.getfile(ReportClass)
     with open(fn, 'r') as f:
         report1_source = f.read()
@@ -78,13 +77,13 @@ def setup_grade_file_report(ReportClass, execute=False, obfuscate=False, minify=
     from unitgrade import version
     from unitgrade import utils
     from unitgrade import runners
-    print(unitgrade.__file__)
+    # print(unitgrade.__file__)
     report1_source = lload([unitgrade.__file__, utils.__file__, runners.__file__, unitgrade.framework.__file__,
                             unitgrade.evaluate.__file__, hidden_gather_upload.__file__,
                             version.__file__], excl) + "\n" + report1_source
 
-    print(sys.getsizeof(picklestring))
-    print(len(picklestring))
+    # print(sys.getsizeof(picklestring))
+    # print(len(picklestring))
     s = jinja2.Environment().from_string(data).render({'Report1': ReportClass.__name__,
                                                        'source': repr(report1_source),
                                                        'payload': picklestring.hex(), #repr(picklestring),
-- 
GitLab