Skip to content

Improve Dolos Hub usability - #124

Merged
mikaelGusse merged 3 commits into
apluslms:masterfrom
mikaelGusse:master
Jul 22, 2026
Merged

Improve Dolos Hub usability#124
mikaelGusse merged 3 commits into
apluslms:masterfrom
mikaelGusse:master

Conversation

@mikaelGusse

Copy link
Copy Markdown
Contributor

Description

What?

[ANSWER HERE]

Why?

[ANSWER HERE]

How?

[ANSWER HERE]

Fixes #

Testing

Remember to add or update unit tests for new features and changes.

What type of test did you run?

  • Accessibility test using the WAVE extension.
  • Django unit tests.
  • Playwright tests.
  • Other test. (Add a description below)
  • Manual testing.

[ADD A DESCRIPTION ABOUT WHAT YOU TESTED MANUALLY]

Did you test the changes in

  • Chrome
  • Firefox
  • This pull request cannot be tested in the browser.

Think of what is affected by these changes and could become broken

Translation

Programming style

  • Did you follow our style guides?
  • Did you use Python type hinting in all functions that you added or edited? (type hints for function parameters and return values)

Have you updated the README or other relevant documentation?

  • documents inside the doc directory.
  • README.md.
  • Aplus Manual.
  • Other documentation (mention below which documentation).

Is it Done?

  • Reviewer has finished the code review
  • After the review, the developer has made changes accordingly
  • Customer/Teacher has accepted the implementation of the feature

Clean up your git commit history before submitting the pull request!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the usability and responsiveness of the Dolos Hub by decoupling the hub page render from potentially slow report generation, while also introducing several performance optimizations in submission selection and dataset/report generation.

Changes:

  • Make dolos_hub render immediately and trigger report generation via a new JSON endpoint (dolos_hub_report) to keep the navigation usable during long-running report generation.
  • Optimize DB access patterns for submissions (e.g., select_related, correlated subquery for best submissions) to reduce query count and improve scalability.
  • Speed up Dolos dataset creation by fetching submission texts concurrently and reusing an HTTP client/session for connection pooling.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
review/views.py Splits hub rendering from report generation; adds scope helper and JSON report-status endpoint.
review/urls.py Adds routes for the new dolos_hub_report AJAX/JSON endpoints (course + exercise scopes).
review/templates/review/dolos_hub.html Adds loading UI and client-side fetch to transition from “generating” state to embedded report iframe.
review/dolos_reports.py Parallelizes get_text calls to reduce end-to-end report build time.
provider/aplus.py Reuses a shared AplusTokenClient/Session with a larger connection pool to support concurrent fetches.
data/models.py Reimplements Exercise.best_submissions using a correlated subquery to avoid O(n) per-student queries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread review/views.py
Comment on lines +914 to +916
selected_count = sum(
_exercise_submissions(ex, include_all).count() for ex in course.exercises.all()
)
Comment thread provider/aplus.py
Comment on lines +95 to +106
global _api_client
if _api_client is None:
client = AplusTokenClient(settings.APLUS_ROBOT_TOKEN)
# Default adapter pool (10 connections) is too small once several
# submissions are fetched concurrently (see review/dolos_reports.py's
# ThreadPoolExecutor); size it generously so threads reuse connections
# instead of opening new ones or blocking for a free slot.
adapter = requests.adapters.HTTPAdapter(pool_connections=32, pool_maxsize=32)
client.session.mount("https://", adapter)
client.session.mount("http://", adapter)
_api_client = client
return _api_client
Comment thread review/dolos_reports.py
``label_fn(submission)`` returns the Dolos colour label and
``get_text(submission)`` returns the source code. Returns the info rows.
"""
submissions = list(submissions)
Comment on lines +44 to +46
fetch("{{ report_status_url|escapejs }}", { headers: { "X-Requested-With": "XMLHttpRequest" } })
.then(function (response) { return response.json(); })
.then(function (data) {
Comment thread review/templates/review/dolos_hub.html Outdated
Comment thread review/views.py
Comment on lines +925 to +929
"""
AJAX endpoint backing dolos_hub's loading indicator: does the actual
(potentially slow) submission gathering + report generation/upload, and
reports back whether a report is ready, empty, or failed.
"""
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mikaelGusse
mikaelGusse merged commit 16a55f6 into apluslms:master Jul 22, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants