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

Added pregrade function

parent 5af39a9a
No related branches found
No related tags found
1 merge request!17Add pregrading
Pipeline #17840 failed
......@@ -27,20 +27,20 @@ def pregrade(exam_token, image):
pass
def add_feedback_to_solution(image, barcode):
def add_feedback_to_solution(page_img, barcode):
exam = Exam.query.filter(Exam.token == barcode.token).first()
sub = Submission.query.filter(Submission.copy_number == barcode.copy, Submission.exam_id == exam.id).one_or_none()
for solution in sub.solutions:
problem = solution.problem
problems = exam.problems
problems_on_page = list(filter(lambda p: p.widget.page == barcode.page, problems))
for problem in problems_on_page:
for mc_option in problem.mc_options:
box = (mc_option.x, mc_option.y)
# check width and so forth
if box_is_filled(box, image):
solution.feedback = mc_option.feedback
if box_is_filled(box, page_img):
problem.solution.feedback = mc_option.feedback
db.session.commit()
......
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