Skip to content

Commit

Permalink
Merge pull request #481 from concord-consortium/188024567-show-studen…
Browse files Browse the repository at this point in the history
…t-report-score

fix: Student feedback not showing rubric score [PT-188024567]
  • Loading branch information
dougmartin authored Sep 12, 2024
2 parents 4d7455c + e96fe33 commit 7a0b450
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
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

0 comments on commit 7a0b450

Please sign in to comment.