Skip to content

Commit

Permalink
(Fixes asiliuk#185) Made examSchedules optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Archichil committed Aug 15, 2024
1 parent 0095189 commit 3cc69c5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Modules/Sources/BsuirApi/Models/StudentGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extension StudentGroup {

public let schedules: DaySchedule?
public let previousSchedules: DaySchedule?
public let examSchedules: [Pair]
public let examSchedules: [Pair]?

private enum CodingKeys: String, CodingKey {
case startDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private extension ScheduleRequestResponse {
startExamsDate: response.startExamsDate,
endExamsDate: response.endExamsDate,
schedule: response.actualSchedule,
exams: response.examSchedules
exams: response.examSchedules ?? []
)
}
}
2 changes: 1 addition & 1 deletion Modules/Tests/BsuirApiTests/GroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class StudentGroupTests: XCTestCase {

// Then
XCTAssertEqual(schedule.schedules?.isEmpty, false)
XCTAssertEqual(schedule.examSchedules.isEmpty, false)
XCTAssertEqual(schedule.examSchedules?.isEmpty, false)
}

func testScheduleParse_withAnnouncement() throws {
Expand Down
2 changes: 1 addition & 1 deletion ScheduleWidget/Provider/Exams/ExamsScheduleProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ final class ExamsScheduleProvider {
deeplink: .group(name: name, displayType: .exams),
title: source.title,
subgroup: preferredSubgroup(for: source),
exams: schedule.examSchedules,
exams: schedule.examSchedules ?? [],
calendar: calendar,
onlyExams: onlyExams
)
Expand Down

0 comments on commit 3cc69c5

Please sign in to comment.