From 5e500f3344a13d375d018312936280d88d47c93c Mon Sep 17 00:00:00 2001 From: adityacp Date: Wed, 15 Mar 2017 17:55:34 +0530 Subject: Change templates and js - Support multiple files uploading in assignment - Create new check field to grade assignement based question - Add js changes --- yaksh/hook_evaluator.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'yaksh/hook_evaluator.py') diff --git a/yaksh/hook_evaluator.py b/yaksh/hook_evaluator.py index 2cc4578..052d220 100644 --- a/yaksh/hook_evaluator.py +++ b/yaksh/hook_evaluator.py @@ -17,6 +17,7 @@ class HookEvaluator(BaseEvaluator): self.user_answer = metadata.get('user_answer') self.file_paths = metadata.get('file_paths') self.partial_grading = metadata.get('partial_grading') + self.assignment_files = metadata.get('assign_files') # Set test case data values self.hook_code = test_case_data.get('hook_code') @@ -26,6 +27,8 @@ class HookEvaluator(BaseEvaluator): # Delete the created file. if self.files: delete_files(self.files) + if self.assign_files: + delete_files(self.assign_files) def check_code(self): """ Function evaluates user answer by running a python based hook code @@ -47,6 +50,10 @@ class HookEvaluator(BaseEvaluator): Returns (False, error_msg, 0.0): If mandatory arguments are not files or if the required permissions are not given to the file(s). """ + if self.file_paths: + self.files = copy_files(self.file_paths) + if self.assignment_files: + self.assign_files = copy_files(self.assignment_files) success = False mark_fraction = 0.0 try: -- cgit From b4b33cc37244ed59765c705c6d882c00ddc88c62 Mon Sep 17 00:00:00 2001 From: adityacp Date: Fri, 17 Mar 2017 20:49:13 +0530 Subject: Intialize empty list for assignment files in hook --- yaksh/hook_evaluator.py | 1 + 1 file changed, 1 insertion(+) (limited to 'yaksh/hook_evaluator.py') diff --git a/yaksh/hook_evaluator.py b/yaksh/hook_evaluator.py index 052d220..0819ec9 100644 --- a/yaksh/hook_evaluator.py +++ b/yaksh/hook_evaluator.py @@ -12,6 +12,7 @@ from .grader import TimeoutException class HookEvaluator(BaseEvaluator): def __init__(self, metadata, test_case_data): self.files = [] + self.assign_files = [] # Set metadata values self.user_answer = metadata.get('user_answer') -- cgit