Skip to content

Commit 756cb38

Browse files
committed
Fix lecture reminder state update issues (#380)
* Initialize reminder lecture list (unset primary) * Fix picker not updating state after setting timeplaces
1 parent a9a37b1 commit 756cb38

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

SNUTT-2022/SNUTT/Services/LectureService.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ struct LectureService: LectureServiceProtocol {
136136
// MARK: Lecture Reminder
137137

138138
func fetchLectureReminderList() async throws {
139-
guard let targetTable = getCurrentOrNextSemesterPrimaryTable() else { return }
139+
guard let targetTable = getCurrentOrNextSemesterPrimaryTable() else {
140+
appState.reminder.reminderList = []
141+
return
142+
}
140143
let dto = try await lectureRepository.fetchLectureReminderList(timetableId: targetTable.id)
141144
appState.reminder.reminderList = dto.map { LectureReminder(from: $0) }
142145
}

SNUTT-2022/SNUTT/Views/Scenes/LectureDetailScene.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ struct LectureDetailScene: View {
2525
_lecture = State(initialValue: lecture)
2626
_editMode = State(initialValue: displayMode == .create ? .active : .inactive)
2727
self.displayMode = displayMode
28+
if viewModel.showLectureReminderPicker() {
29+
viewModel.getLectureReminderOption(lecture)
30+
}
2831
}
2932

3033
enum DisplayMode: Equatable {

0 commit comments

Comments
 (0)