Skip to content
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

LocalDateTime 및 심자, 외출, 외박 버그 수정 #70

Merged
merged 4 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/ProjectProperties.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import org.gradle.api.JavaVersion

object ProjectProperties {
const val VERSION_CODE = 32
const val VERSION_NAME = "2.2.1"
const val VERSION_CODE = 33
const val VERSION_NAME = "2.2.2"

const val APPLICATION_ID = "kr.hs.dgsw.smartschool.dodamdodam_teacher"
const val NAME_SPACE_DOMAIN = "kr.hs.dgsw.smartschool.domain"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fun String?.yearDateTimeToLocalDate(): LocalDateTime {
try {
if (this != null) {
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
return LocalDateTime.parse(this, formatter)
return LocalDateTime.parse(this.split(".")[0], formatter)
}
} catch (e: Exception) {
e.printStackTrace()
Expand All @@ -23,7 +23,8 @@ fun String?.yearDateTimeToLocalDate(): LocalDateTime {
}
fun String.yearDateTimeToLocalDateT(): LocalDateTime {
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")
return LocalDateTime.parse(this, formatter)
val time = if (length == 16) "$this:00" else this
return LocalDateTime.parse(time.split(".")[0], formatter)
}

fun String.yearDateTimeHourToLocalDate(): LocalDateTime {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kr.hs.dgsw.smartschool.local.mapper

import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDate
import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDateT
import kr.hs.dgsw.smartschool.domain.model.member.Member
import kr.hs.dgsw.smartschool.domain.model.member.MemberRole
import kr.hs.dgsw.smartschool.domain.model.member.MemberStatus
Expand Down Expand Up @@ -56,8 +57,8 @@ internal fun Member.toEntity(): MemberEntity {
status = status.name.toMemberStatus(),
teacher = teacher,
student = student,
createdAt = createdAt.yearDateTimeToLocalDate().toString(),
modifiedAt = modifiedAt.yearDateTimeToLocalDate().toString(),
createdAt = createdAt.yearDateTimeToLocalDateT().toString(),
modifiedAt = modifiedAt.yearDateTimeToLocalDateT().toString(),
phone = phone
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ fun OutScreen(
val refreshState = rememberPullRefreshState(
refreshing = state.refreshing,
onRefresh = {
outViewModel.getOutsRefresh()
if (state.currentOutType == 0) {
outViewModel.getOutsRefresh()
} else {
outViewModel.getOutSleepingRefresh()
}
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,35 @@ class OutViewModel @Inject constructor(
reduce {
state.copy(
refreshing = false,
outGoings = it,
outSleepings = it,
outGoings = it.filter { it.status == OutStatus.PENDING },
)
}
}.onFailure {
reduce {
state.copy(
refreshing = false,
)
}
postSideEffect(OutSideEffect.ShowException(it))
}
}

fun getOutSleepingRefresh() = intent {
reduce {
state.copy(
refreshing = true,
)
}

getOutsByDateRemoteUseCase.getOutSleeping(
GetOutsByDateRemoteUseCase.Param(
date = LocalDate.now().toString()
)
).onSuccess {
reduce {
state.copy(
refreshing = false,
outSleepings = it.filter { it.status == OutStatus.PENDING },
)
}
}.onFailure {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,26 @@ class CurrentOutViewModel @Inject constructor(
refreshing = true,
)
}
val param = GetOutsByDateRemoteUseCase.Param(
LocalDate.now().toString()
)

getOutsByDateRemoteUseCase(
GetOutsByDateRemoteUseCase.Param(
LocalDate.now().toString()
)
).onSuccess { outGoing ->
getOutsByDateRemoteUseCase.getOutSleepingValid().onSuccess { outSleeping ->
getOutsByDateRemoteUseCase(param).onSuccess { outGoing ->
getOutsByDateRemoteUseCase.getOutSleeping(param).onSuccess { outSleeping ->
reduce {
state.copy(
refreshing = false,
outGoings = outGoing.filter { it.status == OutStatus.ALLOWED },
outSleepings = outSleeping.filter { it.status == OutStatus.ALLOWED },
)
}
}.onFailure {
reduce {
state.copy(
refreshing = false,
outGoings = outGoing,
outSleepings = outSleeping,
)
}
postSideEffect(CurrentOutSideEffect.ShowException(it))
}
}.onFailure {
reduce {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package kr.hs.dgsw.smartschool.remote.mapper

import kr.hs.dgsw.smartschool.data.data.auth.LoginData
import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDate
import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDateT
import kr.hs.dgsw.smartschool.domain.model.member.Member
import kr.hs.dgsw.smartschool.domain.model.member.MemberRole
import kr.hs.dgsw.smartschool.domain.model.member.MemberStatus
Expand All @@ -28,8 +28,8 @@ internal fun MemberResponse.toMember(): Member =
phone = phone,
student = student?.toModel(),
teacher = teacher?.toModel(),
createdAt = createdAt?.yearDateTimeToLocalDate().toString(),
modifiedAt = modifiedAt?.yearDateTimeToLocalDate().toString(),
createdAt = createdAt?.yearDateTimeToLocalDateT().toString(),
modifiedAt = modifiedAt?.yearDateTimeToLocalDateT().toString(),
)

internal fun MemberResponseRole.toMemberRole(): MemberRole =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kr.hs.dgsw.smartschool.remote.mapper

import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDate
import kr.hs.dgsw.smartschool.data.utils.yearDateTimeToLocalDateT
import kr.hs.dgsw.smartschool.domain.model.out.Out
import kr.hs.dgsw.smartschool.domain.model.out.OutItem
import kr.hs.dgsw.smartschool.domain.model.out.OutStatus
Expand All @@ -22,9 +23,9 @@ internal fun OutResponse.toOut(): Out {
rejectReason = rejectReason ?: "",
startOutDate = startOutDate,
endOutDate = endOutDate,
createdAt = createdAt.yearDateTimeToLocalDate().toString(),
createdAt = createdAt.yearDateTimeToLocalDateT().toString(),

modifiedAt = modifiedAt.yearDateTimeToLocalDate().toString()
modifiedAt = modifiedAt.yearDateTimeToLocalDateT().toString()
)
}

Expand Down
Loading