-
Notifications
You must be signed in to change notification settings - Fork 0
release: 최고 레벨(미션 없음) 응답 및 주간 회고 현황 반영 #279
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ import com.didit.application.achievement.dto.MissionInfo | |
| import com.didit.application.achievement.dto.PopupStatus | ||
| import com.didit.application.achievement.dto.WeeklyStatus | ||
| import com.didit.application.achievement.exception.CurrentMissionNotFoundException | ||
| import com.didit.application.achievement.exception.MissionDefinitionNotFoundException | ||
| import com.didit.application.achievement.exception.UserLevelNotFoundException | ||
| import com.didit.application.achievement.provided.MissionFinder | ||
| import com.didit.application.achievement.required.MissionRepository | ||
|
|
@@ -34,11 +33,21 @@ class MissionQueryService( | |
| ) : MissionFinder { | ||
| override fun getCurrentMission(userId: UUID): CurrentMissionResponse { | ||
| val userLevel = userLevelRepository.findByUserId(userId) ?: throw UserLevelNotFoundException(userId) | ||
| val missionLevel = userLevel.currentLevel + 1 | ||
| val mission = missionRepository.findByLevel(missionLevel) | ||
|
|
||
| if (mission == null) { | ||
| val lastMission = userMissionRepository.findByUserId(userId).firstOrNull() | ||
| return CurrentMissionResponse( | ||
| currentLevel = userLevel.currentLevel, | ||
| mission = null, | ||
| weeklyStatus = buildWeeklyStatusForUser(userId), | ||
| popup = lastMission?.let { getPopupStatus(it) } ?: PopupStatus(exists = false, type = null), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For a user who completed Lv10 after already confirming the popup on the Lv10 mission, this reuses that completed mission's existing Useful? React with 👍 / 👎. |
||
| ) | ||
| } | ||
|
|
||
| val userMission = | ||
| userMissionRepository.findCurrentMissionByUserId(userId) ?: throw CurrentMissionNotFoundException(userId) | ||
| val missionLevel = userLevel.currentLevel + 1 | ||
| val mission = | ||
| missionRepository.findByLevel(missionLevel) ?: throw MissionDefinitionNotFoundException(missionLevel) | ||
|
|
||
| val missionInfo = | ||
| MissionInfo( | ||
|
|
@@ -86,7 +95,10 @@ class MissionQueryService( | |
| if (mission.missionType != MissionType.CONSECUTIVE_WEEK) { | ||
| return null | ||
| } | ||
| return buildWeeklyStatusForUser(userId) | ||
| } | ||
|
|
||
| private fun buildWeeklyStatusForUser(userId: UUID): WeeklyStatus { | ||
| val weekStartDate = getWeekStartDate(ServiceTime.today()) | ||
| val from = ServiceTime.startOfDayUtc(weekStartDate) | ||
| val to = ServiceTime.startOfDayUtc(weekStartDate.plusWeeks(1)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch treats every missing
Missiondefinition as the terminal-level state. Because levels 1–10 are the configured progression andcurrentLevel + 1can be any of those levels, a missing seed/deploy row for e.g. Lv3 now returns200withmission: nulland weekly status for a Lv2 user instead of surfacingMissionDefinitionNotFoundException, making users look maxed out and hiding the data/configuration error. Please only take this path when the user is actually at the cap (or compare against the max mission level) and keep throwing for lower levels.Useful? React with 👍 / 👎.