Skip to content

Commit 290f339

Browse files
committed
🐛 fix(submission): show blocked view when instructor toggles student view (#5488)
1 parent 70d42e7 commit 290f339

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

  • app/views/course/assessment/submission/submissions
  • client/app/bundles/course/assessment/submission/pages/SubmissionEditIndex

app/views/course/assessment/submission/submissions/edit.json.jbuilder

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ json.assessment do
1919
# If submitting with incorrect answers is not allowed, we must show the answer to students regardless
2020
json.showMcqAnswer !@assessment.allow_partial_submission || @assessment.show_mcq_answer
2121
json.showEvaluation @assessment.show_evaluation
22+
json.blockStudentViewingAfterSubmitted @assessment.block_student_viewing_after_submitted
2223
json.questionIds @submission.questions.pluck(:id)
2324
json.passwordProtected @assessment.session_password_protected?
2425
json.gamified @assessment.course.gamified?

client/app/bundles/course/assessment/submission/pages/SubmissionEditIndex/index.jsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,30 @@ class VisibleSubmissionEditIndex extends Component {
158158
}
159159

160160
render() {
161-
const { isSubmissionBlocked, isLoading } = this.props;
161+
const { assessment, isSubmissionBlocked, isLoading, submission } =
162+
this.props;
162163

163164
if (isLoading) return <LoadingIndicator />;
164165
if (isSubmissionBlocked) return <BlockedSubmission />;
166+
167+
const isBlockedInStudentView =
168+
!submission.graderView &&
169+
assessment.blockStudentViewingAfterSubmitted &&
170+
submission.workflowState !== workflowStates.Attempting &&
171+
submission.workflowState !== workflowStates.Published;
172+
165173
return (
166174
<Page className="space-y-5">
167175
{this.renderTimeLimitBanner()}
168176
{this.renderAssessment()}
169-
{this.renderProgress()}
170-
{this.renderContent()}
177+
{isBlockedInStudentView ? (
178+
<BlockedSubmission />
179+
) : (
180+
<>
181+
{this.renderProgress()}
182+
{this.renderContent()}
183+
</>
184+
)}
171185
</Page>
172186
);
173187
}

0 commit comments

Comments
 (0)