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

fix: Student feedback not showing rubric score [PT-188024567] #481

Merged
merged 1 commit into from
Sep 12, 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
19 changes: 17 additions & 2 deletions js/components/report/activity-feedback-for-student.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { PureComponent } from "react";
import FeedbackPanelForStudent from "./feedback-panel-for-student";
import { RUBRIC_SCORE } from "../../util/scoring-constants";
import { computeRubricMaxScore } from "../../selectors/activity-feedback-selectors";

export default class ActivityFeedbackForStudent extends PureComponent {
render() {
Expand All @@ -10,7 +12,7 @@ export default class ActivityFeedbackForStudent extends PureComponent {
useRubric,
rubric,
showScore,
maxScore,
scoreType,
showText,
autoScore,
} = this.props;
Expand All @@ -20,10 +22,23 @@ export default class ActivityFeedbackForStudent extends PureComponent {
feedback = feedback.toJS();
}
const showFeedback = feedback && feedback.hasBeenReviewed;
const score = (autoScore != null) ? autoScore : feedback && feedback.score;
const textFeedback = feedback && feedback.feedback;
const hasBeenReviewed = feedback && feedback.hasBeenReviewed;
const rubricFeedback = feedback && feedback.rubricFeedback;

let score = (autoScore != null) ? autoScore : feedback && feedback.score;
let maxScore = this.props.maxScore;

// re-score the rubric if needed due the teacher dashboard not setting the scoreType and/or score correctly when there is a rubric
if ((scoreType === undefined || (scoreType === RUBRIC_SCORE && score === undefined)) && rubricFeedback && rubric) {
const scoredValues = Object.values(rubricFeedback).filter((v) => v.score > 0);
const numCriteria = rubric.criteriaGroups.reduce((acc, cur) => acc + cur.criteria.length, 0);
if (scoredValues.length === numCriteria) {
score = scoredValues.reduce((acc, cur) => acc + cur.score, 0);
maxScore = computeRubricMaxScore(rubric);
}
}

return (
<FeedbackPanelForStudent
student={student}
Expand Down
1 change: 1 addition & 0 deletions js/containers/report/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class Activity extends PureComponent {
student={reportFor}
feedbacks={feedbacks}
showScore={showScore}
scoreType={scoreType}
maxScore={maxScore}
showText={showText}
useRubric={useRubric}
Expand Down
Loading