-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: 열람실 이용을 시작할 때 uiState의 오늘 studyCount를 늘리는 로직을 구현 #146
base: develop
Are you sure you want to change the base?
Conversation
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.
고생하셨습니다!
@@ -107,6 +107,7 @@ fun HomeRoute( | |||
updateSelectedTime(updatedSelectedTime) | |||
updateTimePickerVisibility(false) | |||
updateTimerRunning(true) | |||
incrementTodayStudyCount() |
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.
increment
는 명사라
increase
를 메소드 시작 이름으로 추천드립니다.
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.
fun incrementTodayStudyCount() { | ||
_homeUiState.update { currentState -> | ||
when (currentState) { | ||
is HomeUiState.Success -> { | ||
val updatedWeeklyStudyDays: List<WeeklyStudyDay> = | ||
currentState.weeklyStudyDays.map { studyDay -> | ||
if (studyDay.date == | ||
LocalDate.now() | ||
.format(DateTimeFormatter.ofPattern("M/dd")) | ||
) { | ||
studyDay.copy(studyCount = studyDay.studyCount + 1) | ||
} else { | ||
studyDay | ||
} | ||
} | ||
currentState.copy(weeklyStudyDays = updatedWeeklyStudyDays) | ||
} | ||
|
||
else -> currentState | ||
} | ||
} | ||
} |
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.
실제 서버엔 적용 안되는 낙관적 UI로 구현하신건가요?
추후 열람실 이용이 종료되면 그제서야 서버에 요청이 들어가는 구조인가요?
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.
네 맞습니다!
resolved #145
AS-IS
TO-BE
KEY-POINT
SCREENSHOT (Optional)
Screen_recording_20241126_162413.mp4