Change threshold to raw points and add custom points per question

This commit is contained in:
Dmitry Belan
2026-09-28 23:41:58 +03:00
parent 85d138280d
commit d7e1364426
2 changed files with 9 additions and 10 deletions
+4 -4
View File
@@ -142,11 +142,11 @@ def assignment_detail(request, pk):
if q.correct_answer:
correct = strip_tags(q.correct_answer).strip().lower()
answer_obj.is_correct = (val.strip().lower() == correct)
answer_obj.points = 1 if answer_obj.is_correct else 0
answer_obj.points = q.points if answer_obj.is_correct else 0
total_points += answer_obj.points
else:
all_auto = False
max_points += 1
max_points += q.points
elif q.question_type == 'TABLE_AUTO':
rows = getattr(q, 'table_rows', 2) or 2
table_data = []
@@ -171,11 +171,11 @@ def assignment_detail(request, pk):
is_correct = False
break
answer_obj.is_correct = is_correct
answer_obj.points = 1 if is_correct else 0
answer_obj.points = q.points if is_correct else 0
total_points += answer_obj.points
else:
all_auto = False
max_points += 1
max_points += q.points
else:
all_auto = False
val = form.cleaned_data.get(f'file_{q.id}')