Skip to content

Commit

Permalink
Merge pull request #266 from OMZigak/hotfix/#264-qa
Browse files Browse the repository at this point in the history
[fix] QA 반영
  • Loading branch information
youz2me authored Jul 19, 2024
2 parents 5f60d2c + 3792e4a commit 62182a2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
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

0 comments on commit 62182a2

Please sign in to comment.