diff --git a/apps/student/src/main/java/com/instructure/student/mobius/assignmentDetails/ui/gradeCell/GradeCellViewState.kt b/apps/student/src/main/java/com/instructure/student/mobius/assignmentDetails/ui/gradeCell/GradeCellViewState.kt index 076741c75c..37df043887 100644 --- a/apps/student/src/main/java/com/instructure/student/mobius/assignmentDetails/ui/gradeCell/GradeCellViewState.kt +++ b/apps/student/src/main/java/com/instructure/student/mobius/assignmentDetails/ui/gradeCell/GradeCellViewState.kt @@ -57,10 +57,8 @@ sealed class GradeCellViewState { assignment: Assignment, submission: Submission? ): GradeCellViewState { - // Return empty state for missing/null submission, unsubmitted workflow state, or "Not Graded" grading type - if (submission?.workflowState == null - || submission.workflowState == "unsubmitted" - || assignment.gradingType == Assignment.NOT_GRADED_TYPE) { + // Return empty state if unsubmitted and ungraded, or "Not Graded" grading type + if ((submission?.submittedAt == null && submission?.isGraded != true) || assignment.gradingType == Assignment.NOT_GRADED_TYPE) { return Empty } diff --git a/apps/student/src/test/java/com/instructure/student/test/assignment/details/GradeCellStateTest.kt b/apps/student/src/test/java/com/instructure/student/test/assignment/details/GradeCellStateTest.kt index 54bc127c64..9d207aaff6 100644 --- a/apps/student/src/test/java/com/instructure/student/test/assignment/details/GradeCellStateTest.kt +++ b/apps/student/src/test/java/com/instructure/student/test/assignment/details/GradeCellStateTest.kt @@ -81,6 +81,32 @@ class GradeCellStateTest : Assert() { assertEquals(expected, actual) } + @Test + fun `Returns Graded state if graded but not submitted`() { + val submission = baseSubmission.copy(submittedAt = null) + val expected = baseGradedState.copy( + graphPercent = 0.85f, + score = "85", + showPointsLabel = true + ) + val actual = GradeCellViewState.fromSubmission(context, baseAssignment, submission) + assertEquals(expected, actual) + } + + @Test + fun `Returns Empty state if graded, not submitted, and grade is hidden`() { + val submission = baseSubmission.copy( + submittedAt = null, + enteredGrade = null, + enteredScore = 0.0, + grade = null, + score = 0.0 + ) + val expected = GradeCellViewState.Empty + val actual = GradeCellViewState.fromSubmission(context, baseAssignment, submission) + assertEquals(expected, actual) + } + @Test fun `Returns Submitted state if submitted but not graded`() { val submission = Submission(