Skip to content

Commit b4a6967

Browse files
fix: Fixes according to PR feedback
1 parent 96b7795 commit b4a6967

File tree

16 files changed

+36
-37
lines changed

16 files changed

+36
-37
lines changed

core/src/main/java/org/openedx/core/data/model/CourseAssignments.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ package org.openedx.core.data.model
22

33
import com.google.gson.annotations.SerializedName
44
import org.openedx.core.data.model.room.discovery.CourseAssignmentsDb
5+
import org.openedx.core.domain.model.CourseAssignments
56

67
data class CourseAssignments(
78
@SerializedName("future_assignments")
89
val futureAssignments: List<CourseDateBlock>?,
910
@SerializedName("past_assignments")
1011
val pastAssignments: List<CourseDateBlock>?
1112
) {
12-
fun mapToDomain(): org.openedx.core.domain.model.CourseAssignments =
13-
org.openedx.core.domain.model.CourseAssignments(
14-
futureAssignments = futureAssignments?.map {
15-
it.mapToDomain()
16-
},
17-
pastAssignments = pastAssignments?.map {
18-
it.mapToDomain()
19-
}
20-
)
13+
fun mapToDomain() = CourseAssignments(
14+
futureAssignments = futureAssignments?.map {
15+
it.mapToDomain()
16+
},
17+
pastAssignments = pastAssignments?.map {
18+
it.mapToDomain()
19+
}
20+
)
2121

2222
fun mapToRoomEntity() = CourseAssignmentsDb(
2323
futureAssignments = futureAssignments?.map {

core/src/main/java/org/openedx/core/data/model/CourseDateBlock.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.os.Parcelable
44
import com.google.gson.annotations.SerializedName
55
import kotlinx.parcelize.Parcelize
66
import org.openedx.core.data.model.room.discovery.CourseDateBlockDb
7+
import org.openedx.core.domain.model.CourseDateBlock
78
import org.openedx.core.utils.TimeUtils
89
import java.util.Date
910

@@ -31,7 +32,7 @@ data class CourseDateBlock(
3132
@SerializedName("first_component_block_id")
3233
val blockId: String = "",
3334
): Parcelable {
34-
fun mapToDomain() = org.openedx.core.domain.model.CourseDateBlock(
35+
fun mapToDomain() = CourseDateBlock(
3536
complete = complete,
3637
date = TimeUtils.iso8601ToDate(date) ?: Date(),
3738
assignmentType = assignmentType,

core/src/main/java/org/openedx/core/data/model/CourseStatus.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package org.openedx.core.data.model
22

33
import com.google.gson.annotations.SerializedName
44
import org.openedx.core.data.model.room.discovery.CourseStatusDb
5+
import org.openedx.core.domain.model.CourseStatus
56

67
data class CourseStatus(
78
@SerializedName("last_visited_module_id")
@@ -13,13 +14,12 @@ data class CourseStatus(
1314
@SerializedName("last_visited_unit_display_name")
1415
val lastVisitedUnitDisplayName: String?
1516
) {
16-
fun mapToDomain(): org.openedx.core.domain.model.CourseStatus =
17-
org.openedx.core.domain.model.CourseStatus(
18-
lastVisitedModuleId = lastVisitedModuleId ?: "",
19-
lastVisitedModulePath = lastVisitedModulePath ?: emptyList(),
20-
lastVisitedBlockId = lastVisitedBlockId ?: "",
21-
lastVisitedUnitDisplayName = lastVisitedUnitDisplayName ?: ""
22-
)
17+
fun mapToDomain() = CourseStatus(
18+
lastVisitedModuleId = lastVisitedModuleId ?: "",
19+
lastVisitedModulePath = lastVisitedModulePath ?: emptyList(),
20+
lastVisitedBlockId = lastVisitedBlockId ?: "",
21+
lastVisitedUnitDisplayName = lastVisitedUnitDisplayName ?: ""
22+
)
2323

2424
fun mapToRoomEntity() = CourseStatusDb(
2525
lastVisitedModuleId = lastVisitedModuleId ?: "",

core/src/main/java/org/openedx/core/data/model/EnrolledCourse.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import org.openedx.core.data.model.room.discovery.EnrolledCourseEntity
55
import org.openedx.core.data.model.room.discovery.ProgressDb
66
import org.openedx.core.domain.model.EnrolledCourse
77
import org.openedx.core.utils.TimeUtils
8+
import org.openedx.core.domain.model.Progress as ProgressDomain
89

910
data class EnrolledCourse(
1011
@SerializedName("audit_access_expires")
@@ -34,7 +35,7 @@ data class EnrolledCourse(
3435
isActive = isActive ?: false,
3536
course = course?.mapToDomain()!!,
3637
certificate = certificate?.mapToDomain(),
37-
progress = progress?.mapToDomain() ?: org.openedx.core.domain.model.Progress.DEFAULT_PROGRESS,
38+
progress = progress?.mapToDomain() ?: ProgressDomain.DEFAULT_PROGRESS,
3839
courseStatus = courseStatus?.mapToDomain(),
3940
courseAssignments = courseAssignments?.mapToDomain()
4041
)

core/src/main/java/org/openedx/core/data/model/Progress.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@ package org.openedx.core.data.model
22

33
import com.google.gson.annotations.SerializedName
44
import org.openedx.core.data.model.room.discovery.ProgressDb
5+
import org.openedx.core.domain.model.Progress
56

67
data class Progress(
78
@SerializedName("assignments_completed")
89
val assignmentsCompleted: Int?,
910
@SerializedName("total_assignments_count")
1011
val totalAssignmentsCount: Int?
1112
) {
12-
fun mapToDomain(): org.openedx.core.domain.model.Progress {
13-
return org.openedx.core.domain.model.Progress(
14-
assignmentsCompleted = assignmentsCompleted ?: 0,
15-
totalAssignmentsCount = totalAssignmentsCount ?: 0
16-
)
17-
}
13+
fun mapToDomain() = Progress(
14+
assignmentsCompleted = assignmentsCompleted ?: 0,
15+
totalAssignmentsCount = totalAssignmentsCount ?: 0
16+
)
1817

1918
fun mapToRoomEntity() = ProgressDb(
2019
assignmentsCompleted = assignmentsCompleted ?: 0,

core/src/main/java/org/openedx/core/presentation/global/InDevelopmentScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ fun InDevelopmentScreen(
2828
style = MaterialTheme.appTypography.headlineMedium
2929
)
3030
}
31-
}
31+
}

core/src/main/java/org/openedx/core/ui/theme/Type.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ data class AppTypography(
1717
val displayLarge: TextStyle,
1818
val displayMedium: TextStyle,
1919
val displaySmall: TextStyle,
20-
val headlineBolt: TextStyle,
20+
val headlineBold: TextStyle,
2121
val headlineLarge: TextStyle,
2222
val headlineMedium: TextStyle,
2323
val headlineSmall: TextStyle,
@@ -74,7 +74,7 @@ internal val LocalTypography = staticCompositionLocalOf {
7474
letterSpacing = 0.sp,
7575
fontFamily = fontFamily
7676
),
77-
headlineBolt = TextStyle(
77+
headlineBold = TextStyle(
7878
fontSize = 34.sp,
7979
lineHeight = 24.sp,
8080
fontWeight = FontWeight.Bold,

core/src/main/java/org/openedx/core/utils/FileUtil.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class FileUtil(val context: Context) {
3131
null
3232
}
3333
}
34-
35-
3634
}
3735

3836
enum class Directories {

dashboard/src/main/java/org/openedx/DashboardUI.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ private fun LockPreview() {
4646
OpenEdXTheme {
4747
Lock()
4848
}
49-
}
49+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ private fun Header(
530530
modifier = Modifier.align(Alignment.CenterStart),
531531
text = stringResource(id = R.string.dashboard_all_courses),
532532
color = MaterialTheme.appColors.textDark,
533-
style = MaterialTheme.appTypography.headlineBolt
533+
style = MaterialTheme.appTypography.headlineBold
534534
)
535535
IconButton(
536536
modifier = Modifier

0 commit comments

Comments
 (0)