refactor: shift grade summary calculation to backend#42
refactor: shift grade summary calculation to backend#42nsprenkle merged 2 commits intorelease-teakfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request refactors grade summary calculation by moving the computational logic from the frontend to the backend. The backend now provides fully computed grade summaries, simplifying the frontend implementation and ensuring consistency. Additionally, the PR introduces visual indicators for hidden grades, including a "Hidden Scores" label and lock icons in the grade summary table, along with a banner on the Progress page that displays the due date for pending grade releases.
- Removed frontend grade calculation logic from
api.jsand replaced it with backend-providedassignmentTypeGradeSummaryandfinalGradesdata - Added UI elements to display hidden grades: lock icons for fully hidden assignment types and "% + Hidden Scores" labels for partially hidden types
- Implemented a due date notice banner that appears when grades are pending release
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/course-home/progress-tab/utils.ts |
Added getLatestDueDateInFuture utility function to find the latest future grade publish date |
src/course-home/progress-tab/grades/messages.ts |
Added new internationalization messages for hidden scores labels and due date notice |
src/course-home/progress-tab/grades/grade-summary/GradeSummaryTableFooter.jsx |
Replaced frontend grade calculation with backend-provided finalGrades data |
src/course-home/progress-tab/grades/grade-summary/GradeSummaryTable.jsx |
Added legend and logic to display lock icons and "Hidden Scores" labels based on hasHiddenContribution property |
src/course-home/progress-tab/grades/grade-summary/GradeSummary.jsx |
Updated to use assignmentTypeGradeSummary instead of assignmentPolicies |
src/course-home/progress-tab/grades/course-grade/CurrentGradeTooltip.jsx |
Added "+ Hidden Scores" indicator to the grade tooltip when applicable |
src/course-home/progress-tab/grades/course-grade/CourseGradeFooter.jsx |
Refactored into smaller components and added due date notice banner for pending grades |
src/course-home/progress-tab/ProgressTab.test.jsx |
Updated tests to validate hidden grades display and due date notice functionality |
src/course-home/data/api.js |
Removed frontend grade calculation functions (calculateAssignmentTypeGrades and normalizeAssignmentPolicies) |
src/course-home/data/__factories__/progressTabData.factory.js |
Added final_grades and assignment_type_grade_summary to test factory data |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Refactors the grade summary logic to delegate all calculation responsibilities to the backend. Previously, the frontend was performing grade summary computations using data fetched from the API. Now, the API itself provides the fully computed grade summary, simplifying the frontend and ensuring consistent results across clients. Additionally, a "Hidden Grades" label has been added in the grade summary table to clearly indicate sections where grades are not visible to learners. Finally, for visibility settings that depend on the due date, this PR adds a banner on the Progress page indicating that grades are not yet released, along with the relevant due date information.
fd728de to
51844a6
Compare
|
NOTE that I'm ignoring all the Copilot suggestions as they are on the original commit which I'm just cherry-picking as-is. |
Cherry-picks the following change from (openedx#1797). This is required for changes to the exams page plugins ( https://github.com/edx/frontend-plugins/pull/111) to work.