Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] QA 반영 #266

Merged
merged 5 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ extension ReadyStatusViewController: UICollectionViewDataSource {
cell.readyStatusButton.setupButton("이동중", .move)
case "준비중":
cell.readyStatusButton.setupButton("준비중", .ready)
cell.readyStatusButton.layer.borderWidth = 0
default:
cell.readyStatusButton.setupButton("꾸물중", .none)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ReadyStatusViewModel {
let myReadyProgressStatus = ObservablePattern<ReadyProgressStatus>(.none)

// 꾸물거림 여부
let isLate = ObservablePattern<Bool>(false)
var isLate = ObservablePattern<Bool>(false)

// 우리들의 준비 현황 스택 뷰에 들어갈 정보들
let participantInfos = ObservablePattern<[Participant]>([])
Expand Down Expand Up @@ -126,6 +126,29 @@ extension ReadyStatusViewModel {
self.moveStartTime.value = timeFormatter.string(from: moveStartTime)
print("이동 시작 시간: \(self.moveStartTime.value)")
}

func checkLate(settingTime: String, realTime: String) {
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "ko_KR")
dateFormatter.dateFormat = "HH시 mm분"

let readyStartDate = dateFormatter.date(from: settingTime)

dateFormatter.dateFormat = "a h:mm"

let preparationStartDate = dateFormatter.date(from: realTime)

if let readyStartDate = readyStartDate, let preparationStartDate = preparationStartDate {
if preparationStartDate.compare(readyStartDate) == .orderedDescending {
self.isLate.value = true
} else {
self.isLate.value = true
}
} else {
self.isLate.value = false
}
}


func fetchMyReadyStatus() {
Task {
Expand Down Expand Up @@ -175,6 +198,12 @@ extension ReadyStatusViewModel {
else {
return
}
DispatchQueue.main.async {
self.checkLate(
settingTime: self.moveStartTime.value,
realTime: self.myReadyStatus.value?.departureAt ?? ""
)
}
}
}
}
Expand All @@ -191,6 +220,12 @@ extension ReadyStatusViewModel {
else {
return
}
DispatchQueue.main.async {
self.checkLate(
settingTime: self.moveTime.value,
realTime: self.myReadyStatus.value?.preparationStartAt ?? ""
)
}
}
}
}
Expand Down