Skip to content

Conversation

@nsprenkle
Copy link
Member

Description

This change is needed for some work we're doing on Learning MFE (https://github.com/edx/frontend-plugins/pull/111). Cherry picking it for compatibility.

Useful information to include:

Supporting information

Jira: https://2u-internal.atlassian.net/browse/AU-2763

Deadline

Early 2026.

…ade (openedx#37399)

This commit migrates the data calculation logic for the GradeSummary
table, which was previously in the frontend-app-learning.

This commit also introduces a new visibility option for assignment
scores: “Never show individual assessment results, but show overall
assessment results after the due date.”

With this option, learners cannot see question-level correctness or
scores at any time. However, once the due date has passed, they can
view their overall score in the total grades section on the Progress
page.

These two changes are coupled with each other because it compromises
the integrity of this data to do the score hiding logic on the front
end.

The corresponding frontend PR is: openedx/frontend-app-learning#1797
@nsprenkle nsprenkle marked this pull request as ready for review December 24, 2025 16:01
Copilot AI review requested due to automatic review settings December 24, 2025 16:01
Copy link

Copilot AI left a comment

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 cherry-picks changes from the main edx-platform repository to add a new grade visibility option called "never_but_include_grade". This option allows course teams to hide individual problem correctness from learners while still including those grades in the final grade calculation after the due date.

Key Changes:

  • Adds a new NEVER_BUT_INCLUDE_GRADE constant to the ShowCorrectness class for managing grade visibility
  • Implements API endpoints to aggregate and summarize assignment-type grades with proper visibility filtering
  • Updates the progress page template to correctly distinguish between grade display and grade calculation logic

Reviewed changes

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

Show a summary per file
File Description
xmodule/graders.py Adds the NEVER_BUT_INCLUDE_GRADE constant and updates correctness_available() to treat it like NEVER for display purposes
xmodule/tests/test_graders.py Adds test coverage for the new NEVER_BUT_INCLUDE_GRADE option
lms/djangoapps/grades/subsection_grade.py Updates show_grades() method to handle grade inclusion logic for NEVER_BUT_INCLUDE_GRADE based on due dates
lms/templates/courseware/progress.html Updates template to use ShowCorrectness.correctness_available() instead of show_grades() for display logic
lms/djangoapps/courseware/tests/test_views.py Adds comprehensive test coverage for NEVER_BUT_INCLUDE_GRADE in progress page scenarios
lms/djangoapps/course_home_api/progress/views.py Adds new API response fields for assignment type grade summaries and filters out NEVER_BUT_INCLUDE_GRADE subsections from section scores
lms/djangoapps/course_home_api/progress/tests/test_views.py Updates test expectations to account for the new NEVER_BUT_INCLUDE_GRADE option in grade calculations
lms/djangoapps/course_home_api/progress/api.py Implements new grade aggregation logic with _AssignmentBucket and _AssignmentTypeGradeAggregator classes
lms/djangoapps/course_home_api/progress/tests/test_api.py Adds comprehensive test scenarios for the new aggregation functionality
lms/djangoapps/course_home_api/progress/serializers.py Adds serializers for assignment type grade summaries and updates subsection serializer to include due dates
cms/templates/js/show-correctness-editor.underscore Adds UI option for course teams to select the "never_but_include_grade" visibility setting

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

<input class="input input-radio" name="show-correctness" type="radio" value="never_but_include_grade" aria-describedby="never_show_correctness_but_include_grade_description" />
<%- gettext('Never show individual assessment results, but show overall assessment results after due date') %>
</label>
<p class='field-message' id='never_show_correctness_description'>
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The id attribute in the paragraph element does not match the aria-describedby attribute in the input element. The input element references 'never_show_correctness_but_include_grade_description' but the paragraph has id='never_show_correctness_description', which is already used by the "Never show assessment results" option above. This will cause an accessibility issue as screen readers will announce the wrong description.

Suggested change
<p class='field-message' id='never_show_correctness_description'>
<p class='field-message' id='never_show_correctness_but_include_grade_description'>

Copilot uses AI. Check for mistakes.
(True, 0.7), # midterm and final are visible to staff
(False, 0.3), # just the midterm is visible to learners
(True, 0.72), # lab, midterm and final are visible to staff
(False, 0.32), # Only lab and midterm is visible to learners
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The comment uses "visible" to mean "included in the grade calculation", which could be confusing since "visible" typically refers to display visibility. Consider rewording to "Only lab and midterm are included in the grade calculation for learners" for clarity.

Suggested change
(False, 0.32), # Only lab and midterm is visible to learners
(False, 0.32), # Only lab and midterm are included in the grade calculation for learners

Copilot uses AI. Check for mistakes.
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.

3 participants