diff --git a/zesje/pregrader.py b/zesje/pregrader.py index 8d1c43bb6e29b8b27ecbd1e0536f4952071be403..3e2fa51ebbe7b52526f0a60a5aaa6ed663af2ca8 100644 --- a/zesje/pregrader.py +++ b/zesje/pregrader.py @@ -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 diff --git a/zesje/scans.py b/zesje/scans.py index ae5da5d2ffc94945824b0fae1c26cb856938d33e..0560e8074f54029e7933eac4dd92d77ad7408c9c 100644 --- a/zesje/scans.py +++ b/zesje/scans.py @@ -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(