Skip to content

Commit

Permalink
fix: count 업데이트 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Sep 18, 2024
1 parent 91717bf commit 339f32b
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ class PoseSnapshotListener(
val targetDate = event.poseSnapshot.createdAt.toLocalDate()

/** 집계 데이터 처리 */
val poseCount = targetDate
.run { poseCountService.findByUidAndDateOrNull(event.poseSnapshot.uid, this) }
val poseCount = poseCountService.findByUidAndDateOrNull(event.poseSnapshot.uid, targetDate)
?: PoseCount(uid = event.poseSnapshot.uid, date = targetDate)

val updatedPoseCount = poseCount.apply {
val typeCount = this.totalCount.count[event.poseSnapshot.type] ?: 0
this.totalCount.count[event.poseSnapshot.type] = typeCount + 1
val type = event.poseSnapshot.type

val typeCount = this.totalCount.count[type] ?: 0
this.totalCount.count[type] = typeCount + 1
}

/** 포즈에 연관된 데이터 처리 */
Expand Down

0 comments on commit 339f32b

Please sign in to comment.