Skip to content

Commit 47ad47e

Browse files
committed
fix: long 저장 방식을 string 저장으로 변경
1 parent c779bc8 commit 47ad47e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

backend/src/main/java/io/f1/backend/domain/stat/dao/StatRedisRepository.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.f1.backend.domain.stat.dao;
22

3+
import static java.lang.Long.parseLong;
34
import static java.util.Objects.requireNonNull;
45

56
import io.f1.backend.domain.stat.dto.StatPageResponse;
@@ -50,8 +51,8 @@ public void initialize(StatWithUserSummary stat) {
5051

5152
// stat:user:{id}
5253
hashOps.put(statUserKey, "nickname", stat.nickname());
53-
hashOps.put(statUserKey, "totalGames", stat.totalGames());
54-
hashOps.put(statUserKey, "winningGames", stat.winningGames());
54+
hashOps.put(statUserKey, "totalGames", String.valueOf(stat.totalGames()));
55+
hashOps.put(statUserKey, "winningGames", String.valueOf(stat.winningGames()));
5556

5657
// stat:rank
5758
zSetOps.add(STAT_RANK, stat.userId(), stat.score());
@@ -135,8 +136,8 @@ private StatResponse convertToStatResponse(TypedTuple<Object> rank, int rankValu
135136
return new StatResponse(
136137
rankValue,
137138
(String) statUserMap.get("nickname"),
138-
(long) statUserMap.get("totalGames"),
139-
(long) statUserMap.get("winningGames"),
139+
parseLong((String) statUserMap.get("totalGames")),
140+
parseLong((String) statUserMap.get("winningGames")),
140141
requireNonNull(rank.getScore()).longValue());
141142
}
142143

@@ -166,8 +167,8 @@ public MyPageInfo getStatByUserId(long userId) {
166167
return new MyPageInfo(
167168
(String) statMap.get("nickname"),
168169
rank + 1,
169-
(long) statMap.get("totalGames"),
170-
(long) statMap.get("winningGames"),
170+
parseLong((String) statMap.get("totalGames")),
171+
parseLong((String) statMap.get("winningGames")),
171172
score.longValue());
172173
}
173174
}

0 commit comments

Comments
 (0)