.
This commit is contained in:
+6
-1
@@ -36,11 +36,16 @@ class LongAnswerForm(ModelForm):
|
||||
fields = ("answer_observations","answer_interpretation","answer_principle_diagnosis","answer_differential_diagnosis","answer_management",)
|
||||
|
||||
|
||||
class MarkLongQuestionForm(ModelForm):
|
||||
class MarkLongQuestionSingleForm(ModelForm):
|
||||
class Meta:
|
||||
model = CidUserAnswer
|
||||
fields = ["score"]
|
||||
|
||||
class MarkLongQuestionDoubleForm(ModelForm):
|
||||
class Meta:
|
||||
model = CidUserAnswer
|
||||
fields = ["score", "mark_reason", "candidate_feedback"]
|
||||
|
||||
|
||||
class ExaminationForm(ModelForm):
|
||||
class Meta:
|
||||
|
||||
+50
-19
@@ -23,13 +23,14 @@ from django.http import HttpResponseRedirect, HttpResponse
|
||||
from .forms import (
|
||||
LongForm,
|
||||
LongSeriesForm, LongSeriesImageFormSet,
|
||||
MarkLongQuestionForm,
|
||||
MarkLongQuestionDoubleForm,
|
||||
MarkLongQuestionSingleForm,
|
||||
SeriesFormSet,
|
||||
ExaminationForm,
|
||||
ExamForm,
|
||||
)
|
||||
from .models import (
|
||||
Long, LongSeries,
|
||||
AnswerMarks, Long, LongSeries,
|
||||
Examination,
|
||||
Exam,
|
||||
CidUserAnswer,
|
||||
@@ -678,30 +679,60 @@ def mark_answer(request, exam_id, question_number, cid):
|
||||
except IndexError:
|
||||
next_unmarked_id = False
|
||||
|
||||
if request.method == "POST":
|
||||
# We use different forms if the exam should be single or double marked
|
||||
|
||||
form = MarkLongQuestionForm(request.POST)
|
||||
if not exam.double_mark:
|
||||
if request.method == "POST":
|
||||
form = MarkLongQuestionSingleForm(request.POST)
|
||||
|
||||
if form.is_valid():
|
||||
# If skip button is pressed skip the question without marking
|
||||
# Skip is problematic if we skip to the next unmarked answer
|
||||
#if "skip" in request.POST:
|
||||
# return redirect("longs:mark_answer", pk=exam_id, sk=question_number, cid=next_unmarked_id)
|
||||
if form.is_valid():
|
||||
# If skip button is pressed skip the question without marking
|
||||
# Skip is problematic if we skip to the next unmarked answer
|
||||
#if "skip" in request.POST:
|
||||
# return redirect("longs:mark_answer", pk=exam_id, sk=question_number, cid=next_unmarked_id)
|
||||
|
||||
# Extract score from form and save it to the object
|
||||
answer.score = form.cleaned_data["score"]
|
||||
answer.save()
|
||||
# Extract score from form and save it to the object
|
||||
answer.score = form.cleaned_data["score"]
|
||||
answer.save()
|
||||
|
||||
if "next" in request.POST:
|
||||
return redirect("longs:mark_answer", exam_id=exam_id, question_number=question_number, cid=next_unmarked_id)
|
||||
if "save" in request.POST:
|
||||
return redirect("longs:mark_answer", exam_id=exam_id, question_number=question_number, cid=cid)
|
||||
#elif "previous" in request.POST:
|
||||
# return redirect("longs:mark_question_overview", pk=exam_id, sk=n - 1)
|
||||
if "next" in request.POST:
|
||||
return redirect("longs:mark_answer", exam_id=exam_id, question_number=question_number, cid=next_unmarked_id)
|
||||
if "save" in request.POST:
|
||||
return redirect("longs:mark_answer", exam_id=exam_id, question_number=question_number, cid=cid)
|
||||
#elif "previous" in request.POST:
|
||||
# return redirect("longs:mark_question_overview", pk=exam_id, sk=n - 1)
|
||||
|
||||
else:
|
||||
form = MarkLongQuestionSingleForm(initial={'score': answer.score})
|
||||
|
||||
else:
|
||||
form = MarkLongQuestionForm(initial={'score': answer.score})
|
||||
mark_object = AnswerMarks.objects.get_or_create(user_answer=answer, marker=request.user)
|
||||
if request.method == "POST":
|
||||
form = MarkLongQuestionDoubleForm(request.POST)
|
||||
|
||||
if form.is_valid():
|
||||
# If skip button is pressed skip the question without marking
|
||||
# Skip is problematic if we skip to the next unmarked answer
|
||||
#if "skip" in request.POST:
|
||||
# return redirect("longs:mark_answer", pk=exam_id, sk=question_number, cid=next_unmarked_id)
|
||||
|
||||
|
||||
# Extract score from form and save it to the object
|
||||
mark_object.score = form.cleaned_data["score"]
|
||||
mark_object.mark_reason = form.cleaned_data["mark_reason"]
|
||||
mark_object.candidate_feedback = form.cleaned_data["candidate_feedback"]
|
||||
mark_object.marker = request.user
|
||||
mark_object.save()
|
||||
|
||||
if "next" in request.POST:
|
||||
return redirect("longs:mark_answer", exam_id=exam_id, question_number=question_number, cid=next_unmarked_id)
|
||||
if "save" in request.POST:
|
||||
return redirect("longs:mark_answer", exam_id=exam_id, question_number=question_number, cid=cid)
|
||||
#elif "previous" in request.POST:
|
||||
# return redirect("longs:mark_question_overview", pk=exam_id, sk=n - 1)
|
||||
|
||||
else:
|
||||
form = MarkLongQuestionDoubleForm(initial={'score': mark_object.score,'mark_reason': mark_object.mark_reason,'candidate_feedback': mark_object.candidate_feedback, })
|
||||
|
||||
return render(
|
||||
request,
|
||||
|
||||
Reference in New Issue
Block a user