Skip to content

Commit 7f595c1

Browse files
committed
Add not visible problems to problem_set statistics
1 parent 1155e90 commit 7f595c1

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

web/courses/models.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,8 @@ def observed_students(self):
200200
def student_success(self):
201201
students = self.observed_students()
202202
problem_sets = self.problem_sets.filter(visible=True)
203-
part_count = Part.objects.filter(
204-
problem__problem_set__in=problem_sets, problem__visible=True
205-
).count()
206-
attempts = Attempt.objects.filter(
207-
part__problem__problem_set__in=problem_sets, part__problem__visible=True
208-
)
203+
part_count = Part.objects.filter(problem__problem_set__in=problem_sets).count()
204+
attempts = Attempt.objects.filter(part__problem__problem_set__in=problem_sets)
209205
valid_attempts = (
210206
attempts.filter(valid=True).values("user").annotate(Count("user"))
211207
)
@@ -260,7 +256,7 @@ def student_success_by_problem_set(self):
260256
"problems", "problems__parts"
261257
):
262258
different_subtasks = 0
263-
for problem in problem_set.visible_problems:
259+
for problem in problem_set.problems.all():
264260
different_subtasks += problem.parts.count()
265261

266262
# In case there are no parts, we do not want to divide by 0
@@ -276,7 +272,6 @@ def student_success_by_problem_set(self):
276272
attempts = Attempt.objects.filter(
277273
part__problem__problem_set=problem_set,
278274
user__in=students,
279-
part__problem__visible=True,
280275
)
281276
for attempt in attempts:
282277
if attempt.valid:

0 commit comments

Comments
 (0)