Skip to content

Commit

Permalink
♻️ 마감 시간 이후에도 리스트에 기프티콘이 남아있는 이슈 대응 (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
szzang-kr committed Aug 25, 2022
1 parent eef1b22 commit 076ec3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Projects/App/Sources/Main/MainViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ extension MainViewModel {
})
.disposed(by: disposeBag)

// 마감 시간이 지나고 바로 리스트 재요청 시 그대로 남아있는 이슈가 있음
// 따라서 delay 400ms를 추가함
mainDataSource.didDeadLineCountdownTimeOver
.delay(.milliseconds(400), scheduler: MainScheduler.instance)
.subscribe(onNext: { [weak self] in
self?.reload()
})
Expand Down
7 changes: 5 additions & 2 deletions Projects/App/Sources/Usecase/GifticonEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ struct GifticonEntity {

init(_ responseModel: [GifticonResponseModel] = []) {
gifticonList = responseModel.compactMap({ model in
GifticonCard(
// 마감 시간이 지난 경우 리스트에 노출되지 않도록 방어
guard model.sprinkleAt.fullStringDate().compare(Date()) != .orderedAscending else { return nil }
return GifticonCard(
sprinkleTime: model.sprinkleAt,
gifticonInfo: Gifticon(
id: model.sprinkleID,
Expand All @@ -22,7 +24,8 @@ struct GifticonEntity {
expirationDate: model.expiredAt,
category: Category(rawValue: model.category) ?? .all),
numberOfParticipants: model.participants,
isParticipating: model.participateIn)
isParticipating: model.participateIn
)
})
}
}

0 comments on commit 076ec3b

Please sign in to comment.