Skip to content

Commit

Permalink
refactor: Rename EnrollmentStatus field (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
PavloNetrebchuk authored Oct 17, 2024
1 parent a8b7395 commit bbf71e3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ data class EnrollmentStatus(
val courseId: String?,
@SerializedName("course_name")
val courseName: String?,
@SerializedName("is_active")
val isActive: Boolean?
@SerializedName("recently_active")
val recentlyActive: Boolean?
) {
fun mapToDomain() = EnrollmentStatus(
courseId = courseId ?: "",
courseName = courseName ?: "",
isActive = isActive ?: false
recentlyActive = recentlyActive ?: false
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package org.openedx.core.domain.model
data class EnrollmentStatus(
val courseId: String,
val courseName: String,
val isActive: Boolean
val recentlyActive: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class CalendarSyncWorker(
val courseId = enrollmentStatus.courseId
try {
createCalendarState(enrollmentStatus)
if (enrollmentStatus.isActive && isCourseSyncEnabled(courseId)) {
if (enrollmentStatus.recentlyActive && isCourseSyncEnabled(courseId)) {
val courseDates = calendarInteractor.getCourseDates(courseId)
val isCourseCalendarUpToDate = isCourseCalendarUpToDate(courseId, courseDates)
if (!isCourseCalendarUpToDate) {
Expand Down Expand Up @@ -191,7 +191,7 @@ class CalendarSyncWorker(
if (courseCalendarStateChecksum == null) {
val courseCalendarStateEntity = CourseCalendarStateEntity(
courseId = enrollmentStatus.courseId,
isCourseSyncEnabled = enrollmentStatus.isActive
isCourseSyncEnabled = enrollmentStatus.recentlyActive
)
calendarInteractor.insertCourseCalendarStateEntityToCache(courseCalendarStateEntity)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private fun CourseCheckboxList(
.filter { it.courseId in courseIds }
.let { enrollments ->
if (uiState.isHideInactiveCourses) {
enrollments.filter { it.isActive }
enrollments.filter { it.recentlyActive }
} else {
enrollments
}
Expand All @@ -299,7 +299,7 @@ private fun CourseCheckboxList(
?: false
val annotatedString = buildAnnotatedString {
append(course.courseName)
if (!course.isActive) {
if (!course.recentlyActive) {
append(" ")
withStyle(
style = SpanStyle(
Expand Down Expand Up @@ -327,7 +327,7 @@ private fun CourseCheckboxList(
uncheckedColor = MaterialTheme.appColors.textFieldText
),
checked = isCourseSyncEnabled,
enabled = course.isActive,
enabled = course.recentlyActive,
onCheckedChange = { isEnabled ->
onCourseSyncCheckChange(isEnabled, course.courseId)
}
Expand Down

0 comments on commit bbf71e3

Please sign in to comment.