Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Reduce database calls when generating problem responses report #33940

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lms/djangoapps/courseware/user_state_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def iter_all_for_block(self, block_key, scope=Scope.user_state):
if scope != Scope.user_state:
raise ValueError("Only Scope.user_state is supported")

results = StudentModule.objects.order_by('id').filter(module_state_key=block_key)
results = StudentModule.objects.order_by('id').filter(module_state_key=block_key).select_related('student')
p = Paginator(results, settings.USER_STATE_BATCH_SIZE)

for page_number in p.page_range:
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/instructor_analytics/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def list_problem_responses(course_key, problem_location, limit_responses=None):
smdat = StudentModule.objects.filter(
course_id=course_key,
module_state_key=problem_key
)
).select_related('student')
smdat = smdat.order_by('student')
if limit_responses is not None:
smdat = smdat[:limit_responses]
Expand Down
Loading