Skip to content
Snippets Groups Projects
Commit 4560a99e authored by Ruben Young On's avatar Ruben Young On
Browse files

Added barebones structure for pregrading

parent 70c90407
No related branches found
No related tags found
1 merge request!17Add pregrading
Pipeline #17818 passed with warnings
......@@ -9,9 +9,7 @@
# coupled feedback cannot be deleted
from zesje.database import db, Exam, FeedbackOption
from zesje.images import guess_dpi
from zesje.database import db, Exam
def pregrade(exam_token, image):
......@@ -21,6 +19,7 @@ def pregrade(exam_token, image):
exam = Exam.query.get(exam_token=exam_token)
problems = exam.problems
mc_options = [problem.mc_options for problem in problems]
coords = [(cb.x, cb.y) for cb in mc_options]
......@@ -28,7 +27,7 @@ def pregrade(exam_token, image):
pass
def add_feedback_to_solution(solution):
def add_feedback_to_solution(solution, image):
problem = solution.problem
for mc_option in problem.mc_options:
......@@ -36,11 +35,14 @@ def add_feedback_to_solution(solution):
# check width and so forth
# if box is filled
if True:
if box_is_filled(box, image):
solution.feedback = mc_option.feedback
db.session.commit()
def box_is_filled(box, image):
pass
def _locate_checkbox():
pass
......@@ -241,6 +241,7 @@ def process_page(image_data, exam_config, output_dir=None, strict=False):
return True, "Testing, image not saved and database not updated."
update_database(image_path, barcode)
# call our own function to pregrade
if barcode.page == 0:
description = guess_student(
......
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