From 339f32be9aaa4add0c684a6c889d3247c9e30418 Mon Sep 17 00:00:00 2001 From: DongGeon0908 Date: Wed, 18 Sep 2024 11:36:30 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20count=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hero/alignlab/event/listener/PoseSnapshotListener.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/hero/alignlab/event/listener/PoseSnapshotListener.kt b/src/main/kotlin/com/hero/alignlab/event/listener/PoseSnapshotListener.kt index abed90c..44b4703 100644 --- a/src/main/kotlin/com/hero/alignlab/event/listener/PoseSnapshotListener.kt +++ b/src/main/kotlin/com/hero/alignlab/event/listener/PoseSnapshotListener.kt @@ -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 } /** 포즈에 연관된 데이터 처리 */