Assessment: Show completion and results diagrams on evaluation overview pages#1913
Conversation
📝 WalkthroughWalkthroughChangesEvaluation analytics
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant TutorOverviewPage
participant useGetAllEvaluations
participant AssessmentAPI
participant getScoreLevelsFromEvaluations
participant AnalyticsDiagrams
TutorOverviewPage->>useGetAllEvaluations: load evaluations for phaseId
useGetAllEvaluations->>AssessmentAPI: request phase evaluations
AssessmentAPI-->>useGetAllEvaluations: return Evaluation[]
TutorOverviewPage->>getScoreLevelsFromEvaluations: compute tutor score levels
TutorOverviewPage->>AnalyticsDiagrams: render participations, completions, and score levels
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Assessment: Show assessment diagrams on evaluation overview pagesAssessment: Show completion and results diagrams on evaluation overview pages
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
clients/assessment_component/src/assessment/pages/components/diagrams/AssessmentDiagram.tsx (1)
34-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDecouple
completionstype fromCompetencyScoreCompletion.Since
participationswas broadened to an inline generic type and this component is now used withEvaluationCompletiondata,completionsshould also be broadened. This avoids type mismatches and decouples the component from specific domain interfaces.♻️ Proposed refactor
participations: Array<{ courseParticipationID: string }> scoreLevels: ScoreLevelWithParticipation[] - completions: CompetencyScoreCompletion[] + completions: Array<{ courseParticipationID: string; completed?: boolean }>🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@clients/assessment_component/src/assessment/pages/components/diagrams/AssessmentDiagram.tsx` around lines 34 - 36, Update the AssessmentDiagram component’s completions prop type to use an inline generic shape containing only the fields this component consumes, rather than CompetencyScoreCompletion. Ensure it accepts EvaluationCompletion data while preserving the existing completion-handling behavior and remove the unnecessary domain-interface coupling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@clients/assessment_component/src/assessment/pages/TutorOverviewPage/TutorOverviewPage.tsx`:
- Around line 31-34: Update the useQuery call in TutorOverviewPage to add
enabled: !!phaseId, preventing requests when phaseId is unavailable. Define a
stable module-level empty completions constant typed as EvaluationCompletion[]
and use it instead of the inline [] data fallback, adding the required
EvaluationCompletion import so tutorEvaluationCompletions retains memoization.
---
Nitpick comments:
In
`@clients/assessment_component/src/assessment/pages/components/diagrams/AssessmentDiagram.tsx`:
- Around line 34-36: Update the AssessmentDiagram component’s completions prop
type to use an inline generic shape containing only the fields this component
consumes, rather than CompetencyScoreCompletion. Ensure it accepts
EvaluationCompletion data while preserving the existing completion-handling
behavior and remove the unnecessary domain-interface coupling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 74eb3d29-255e-457f-aed1-33e9c6393b3d
📒 Files selected for processing (7)
clients/assessment_component/src/assessment/network/queries/getAllEvaluations.tsclients/assessment_component/src/assessment/pages/EvaluationParticipantResultsPage/EvaluationParticipantsOverviewPage.tsxclients/assessment_component/src/assessment/pages/TutorOverviewPage/TutorOverviewPage.tsxclients/assessment_component/src/assessment/pages/components/diagrams/AssessmentDiagram.tsxclients/assessment_component/src/assessment/pages/components/diagrams/ScoreLevelDistributionDiagram.tsxclients/assessment_component/src/assessment/pages/hooks/useGetAllEvaluations.tsclients/assessment_component/src/assessment/pages/utils/getScoreLevelsFromEvaluations.ts
📝 Pull Request Template
Use this template to provide all necessary information for reviewing and testing your changes. closes #755
✨ What is the change?
Adds assessment-style diagrams to the top of the three lecturer evaluation overview pages (Tutor Overview, Self Evaluations, Peer Evaluations):
AssessmentDiagram) used on the Assessment Participants page, fed each page'sAssessmentType-filteredEvaluationCompletion[].ScoreLevelDistributionDiagram) used on the Assessment Statistics page, fed a per-participant aggregate score level computed from all evaluations of that type.The per-participant aggregate reuses the existing bulk endpoint
GET /course_phase/{id}/evaluation(getAllEvaluationsByPhase) via a newgetAllEvaluationsquery/useGetAllEvaluationshook, and agetScoreLevelsFromEvaluationsutil that groups evaluations by target participant and averages their score levels with the sharedmapScoreLevelToNumber/mapNumberToScoreLevelhelpers.AssessmentDiagramandScoreLevelDistributionDiagramwere minimally generalized (broadenedparticipationsto a structural shape;AssessmentDiagramgainedTUTORlabels;ScoreLevelDistributionDiagramgained optionaltitle/description) rather than duplicated. Existing callers are unchanged.📌 Reason for the change / Link to issue
Closes #868 and #755. The evaluation overview pages showed only tables; lecturers had no at-a-glance view of completion and results. Grade-distribution diagrams are intentionally omitted for evaluations because evaluations have no grade suggestion (that is assessment-only).
🧪 How to Test
cd clients/assessment_component && npx tsc --noEmit -p tsconfig.jsonandnpx biome checkon the changed files pass.🖼️ Screenshots (if UI changes are included)
✅ PR Checklist
Summary by CodeRabbit