Skip to content

Commit

Permalink
Merge pull request #83 from mash-up-kr/fix/group-after-join
Browse files Browse the repository at this point in the history
fix: Catch exception with late joining
  • Loading branch information
210-reverof committed Sep 6, 2024
2 parents 65599c9 + 721aab4 commit c097330
Showing 1 changed file with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ class GroupApplicationService(
cardFrontImageUrl = group.imageUrl
} else if (lastEvent.eventStatus == EventStatus.COMPLETE) { // 현 이벤트 X, 역대 이벤트 O
status =
if (eventService.hasVisitedEvent(userId, lastEvent.id)) { // 방문했다면
GroupViewStatus.NO_CURRENT_EVENT
} else {
GroupViewStatus.EVENT_COMPLETED
}
runCatching {
if (eventService.hasVisitedEvent(userId, lastEvent.id)) {
GroupViewStatus.NO_CURRENT_EVENT
} else {
GroupViewStatus.EVENT_COMPLETED
}
}.getOrDefault(GroupViewStatus.NO_CURRENT_EVENT)
recentEventDetail = RecentEventDetail(lastEvent.id, lastEvent.description, lastEvent.date, getDeadline(lastEvent))
cardBackImages = resultService.getResultOfEvent(lastEvent.id)
cardFrontImageUrl = cardBackImages.resultImages[0].imageUrl
Expand All @@ -107,18 +109,22 @@ class GroupApplicationService(
status =
when (lastEvent.eventStatus) {
EventStatus.UPLOADING ->
if (uploadService.hasUserUploaded(userId, lastEvent.id)) {
GroupViewStatus.AFTER_MY_UPLOAD
} else {
GroupViewStatus.BEFORE_MY_UPLOAD
}
runCatching {
if (uploadService.hasUserUploaded(userId, lastEvent.id)) {
GroupViewStatus.AFTER_MY_UPLOAD
} else {
GroupViewStatus.BEFORE_MY_UPLOAD
}
}.getOrDefault(GroupViewStatus.AFTER_MY_UPLOAD)

EventStatus.VOTING ->
if (voteService.hasUserVoted(userId, lastEvent.id)) {
GroupViewStatus.AFTER_MY_VOTE
} else {
GroupViewStatus.BEFORE_MY_VOTE
}
runCatching {
if (voteService.hasUserVoted(userId, lastEvent.id)) {
GroupViewStatus.AFTER_MY_VOTE
} else {
GroupViewStatus.BEFORE_MY_VOTE
}
}.getOrDefault(GroupViewStatus.AFTER_MY_VOTE)

else -> {
GroupViewStatus.NO_CURRENT_EVENT
Expand Down

0 comments on commit c097330

Please sign in to comment.