diff --git a/Core/Core/Data/Model/Data_PrimaryEnrollment.swift b/Core/Core/Data/Model/Data_PrimaryEnrollment.swift index 1102bae78..60764c78a 100644 --- a/Core/Core/Data/Model/Data_PrimaryEnrollment.swift +++ b/Core/Core/Data/Model/Data_PrimaryEnrollment.swift @@ -36,7 +36,7 @@ public extension DataLayer { public let certificate: DataLayer.Certificate? public let courseModes: [CourseMode]? public let courseStatus: CourseStatus? - public let progress: CourseProgress? + public let progress: DataLayer.CourseProgress? public let courseAssignments: CourseAssignments? enum CodingKeys: String, CodingKey { diff --git a/Course/Course/Data/Model/Data_CourseOutlineResponse.swift b/Course/Course/Data/Model/Data_CourseOutlineResponse.swift index 4259c286e..4614736ba 100644 --- a/Course/Course/Data/Model/Data_CourseOutlineResponse.swift +++ b/Course/Course/Data/Model/Data_CourseOutlineResponse.swift @@ -233,19 +233,4 @@ public extension DataLayer { case streamPriority = "stream_priority" } } - - struct CourseProgress: Codable { - public let totalAssignmentsCount: Int? - public let assignmentsCompleted: Int? - - public init(totalAssignmentsCount: Int, assignmentsCompleted: Int) { - self.totalAssignmentsCount = totalAssignmentsCount - self.assignmentsCompleted = assignmentsCompleted - } - - enum CodingKeys: String, CodingKey { - case totalAssignmentsCount = "total_assignments_count" - case assignmentsCompleted = "assignments_completed" - } - } } diff --git a/Course/Course/Presentation/Subviews/CustomDisclosureGroup.swift b/Course/Course/Presentation/Subviews/CustomDisclosureGroup.swift index 4162985ec..febd08109 100644 --- a/Course/Course/Presentation/Subviews/CustomDisclosureGroup.swift +++ b/Course/Course/Presentation/Subviews/CustomDisclosureGroup.swift @@ -342,7 +342,8 @@ struct CustomDisclosureGroup_Previews: PreviewProvider { courseStart: Date(), courseEnd: nil, enrollmentStart: Date(), - enrollmentEnd: nil, + enrollmentEnd: nil, + lastVisitedBlockID: nil, coreAnalytics: CoreAnalyticsMock() ) Task { diff --git a/OpenEdX/Data/CoursePersistence.swift b/OpenEdX/Data/CoursePersistence.swift index c2fd84681..94ded4e9b 100644 --- a/OpenEdX/Data/CoursePersistence.swift +++ b/OpenEdX/Data/CoursePersistence.swift @@ -75,7 +75,7 @@ public class CoursePersistence: CoursePersistenceProtocol { let requestBlocks = CDCourseBlock.fetchRequest() requestBlocks.predicate = NSPredicate(format: "courseID = %@", courseID) - + let blocks = try? context.fetch(requestBlocks).map { let userViewData = DataLayer.CourseDetailUserViewData( transcripts: $0.transcripts?.jsonStringToDictionary() as? [String: String], @@ -148,8 +148,8 @@ public class CoursePersistence: CoursePersistenceProtocol { org: structure.org ?? "", isSelfPaced: structure.isSelfPaced, courseProgress: DataLayer.CourseProgress( - totalAssignmentsCount: Int(structure.totalAssignmentsCount), - assignmentsCompleted: Int(structure.assignmentsCompleted) + assignmentsCompleted: Int(structure.assignmentsCompleted), + totalAssignmentsCount: Int(structure.totalAssignmentsCount) ) ) }