Skip to content

Commit 014acd6

Browse files
committed
fix: prevent course progress from being NaN if total assignment count is 0
1 parent 583e2fe commit 014acd6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dashboard/src/main/java/org/openedx/courses/presentation/AllEnrolledCoursesView.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,15 @@ fun CourseItem(
431431
.fillMaxWidth()
432432
.height(90.dp)
433433
)
434-
val progress: Float = try {
434+
var progress: Float = try {
435435
course.progress.assignmentsCompleted.toFloat() / course.progress.totalAssignmentsCount.toFloat()
436436
} catch (_: ArithmeticException) {
437437
0f
438438
}
439+
440+
if (progress.isNaN()){
441+
progress = 0.0f
442+
}
439443
LinearProgressIndicator(
440444
modifier = Modifier
441445
.fillMaxWidth()

0 commit comments

Comments
 (0)