Skip to content
Snippets Groups Projects
Commit c8692015 authored by tuhe's avatar tuhe
Browse files

Changes to evaluation code

parent 678051eb
No related branches found
No related tags found
No related merge requests found
......@@ -736,7 +736,8 @@ def docker_stagewise_evaluation(base_directory, Dockerfile=None, instructor_grad
if plagiarism_check and True:
from unitgrade_private.plagiarism.mossit import moss_it2023
moss_it2023(submissions_base_dir=stage4_dir, submissions_pattern="*-token", instructor_grade_script=instructor_grade_script)
moss_it2023(submissions_base_dir=stage4_dir, submissions_pattern="*-token", instructor_grade_script=instructor_grade_script,
student_files_dir=student_handout_folder)
if plagiarism_check and False: # This check is based on detector and is deprecated. I don't like detector.
from coursebox.core.info_paths import get_paths
......
......@@ -56,7 +56,9 @@ def get_id(moss_pl):
pl = [line for line in f.read().splitlines() if "$userid=" in line].pop()
return pl.split("=")[1][:-1]
def moss_it2023(submissions_base_dir=None, submissions_pattern="*-token", whitelisted_tokens="", instructor_grade_script=None, moss_id=None):
def moss_it2023(submissions_base_dir=None, submissions_pattern="*-token", whitelisted_tokens="", instructor_grade_script=None, moss_id=None,
student_files_dir=None):
a = 234
# submissions_base_dir = stage4_dir
......@@ -66,12 +68,16 @@ def moss_it2023(submissions_base_dir=None, submissions_pattern="*-token", whitel
working_dir = os.path.dirname(submissions_base_dir) + "/moss"
if not os.path.isdir(working_dir):
os.makedirs(working_dir)
handout_dir = working_dir + "/handouts"
if not os.path.isdir(working_dir + "/handouts"):
# handout_dir = working_dir + "/handouts"
if not os.path.isdir(handout_dir := working_dir + "/handouts"):
os.makedirs(working_dir + "/handouts")
print("Put reference files (handouts) in the directory", handout_dir)
from unitgrade_private.token_loader import get_coverage_files
from coursebox import get_paths
paths = get_paths()
student_files_dir = paths['02450students']
cov_files = None
for f in glob.glob(submissions_base_dir + "/" + submissions_pattern):
if os.path.isdir(f):
......@@ -95,6 +101,18 @@ def moss_it2023(submissions_base_dir=None, submissions_pattern="*-token", whitel
for g in i:
if os.path.isfile(student_file := f"{tmpdirname}/{g}"):
shutil.copy(student_file, f"{sdir}/{os.path.basename(g)}")
if student_files_dir is not None:
for q in cov_files:
for item in cov_files[q]:
for file in cov_files[q][item]:
if len(all_files := glob.glob(student_files_dir + "/**/" + file, recursive=True)) > 0:
ff = all_files[0]
shutil.copy(ff, handout_dir + "/" + os.path.basename(ff))
else:
print("Moss warning> Student file not found. Probably you cahnged the file names of the handout. Skipping.", file)
# Now submit it to moss.
import mosspy
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment