def get_question_structure(evalpk, parentpk): evaluation = get_object_or_404(Evaluation, pk=evalpk) parent = get_object_or_404(Question, pk=parentpk) root = Question.get_root_nodes().filter(evaluation=evaluation, stype="EVL")[0] questions = Question.get_annotated_list(root) return evaluation, parent, questions
def correction(request, evalpk, studentpk): """ Display and store the correction of an evaluation (single page) - get evaluation, evaluation questions - for each question, get points / evalitems - for each point / evalitem, search details - if no details, display a form for the teacher with answers - if details, search for an answer using the questionform - process answer, put point - if process fail, display a form - if no form is given """ ## DEBUG student = get_object_or_404(Student, pk=studentpk) evaluation = get_object_or_404(Evaluation, pk=evalpk) root = Question.get_root_nodes().filter(evaluation=evaluation, stype="EVL")[0] questions = Question.get_annotated_list(root) for question, _annotation in questions: # get evalitem for evalitem in question.evalitems.all(): evdetails = evalitem.details.all() if evdetails is None: # display a form pass else: for evdetail in evalitem.details.all(): corr = evdetail.correction(student) for cr in corr: cr.save() return render(request, 'evaluation/correction/correction.html', {'evaluation': evaluation, 'questions': questions})