Skip to content

Commit eb7a0b8

Browse files
[Student][R-6.6.4] Don't show grade if submission is graded, unsubmitted, and muted/hidden (#432)
1 parent bac6efe commit eb7a0b8

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

apps/student/src/main/java/com/instructure/student/mobius/assignmentDetails/ui/gradeCell/GradeCellViewState.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ sealed class GradeCellViewState {
5757
assignment: Assignment,
5858
submission: Submission?
5959
): GradeCellViewState {
60-
// Return empty state for missing/null submission, unsubmitted workflow state, or "Not Graded" grading type
61-
if (submission?.workflowState == null
62-
|| submission.workflowState == "unsubmitted"
63-
|| assignment.gradingType == Assignment.NOT_GRADED_TYPE) {
60+
// Return empty state if unsubmitted and ungraded, or "Not Graded" grading type
61+
if ((submission?.submittedAt == null && submission?.isGraded != true) || assignment.gradingType == Assignment.NOT_GRADED_TYPE) {
6462
return Empty
6563
}
6664

apps/student/src/test/java/com/instructure/student/test/assignment/details/GradeCellStateTest.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,32 @@ class GradeCellStateTest : Assert() {
8181
assertEquals(expected, actual)
8282
}
8383

84+
@Test
85+
fun `Returns Graded state if graded but not submitted`() {
86+
val submission = baseSubmission.copy(submittedAt = null)
87+
val expected = baseGradedState.copy(
88+
graphPercent = 0.85f,
89+
score = "85",
90+
showPointsLabel = true
91+
)
92+
val actual = GradeCellViewState.fromSubmission(context, baseAssignment, submission)
93+
assertEquals(expected, actual)
94+
}
95+
96+
@Test
97+
fun `Returns Empty state if graded, not submitted, and grade is hidden`() {
98+
val submission = baseSubmission.copy(
99+
submittedAt = null,
100+
enteredGrade = null,
101+
enteredScore = 0.0,
102+
grade = null,
103+
score = 0.0
104+
)
105+
val expected = GradeCellViewState.Empty
106+
val actual = GradeCellViewState.fromSubmission(context, baseAssignment, submission)
107+
assertEquals(expected, actual)
108+
}
109+
84110
@Test
85111
fun `Returns Submitted state if submitted but not graded`() {
86112
val submission = Submission(

0 commit comments

Comments
 (0)