Skip to content

Commit af5d870

Browse files
authored
[Fix] #81 병합 후 REJECTED, PENDING 상태 반영 누락 수정 (#83)
* fix: 투표 목록 응답에서 voteStatus 대신 종료 시각 기반으로 상태 계산하도록 수정 (#81) * fix: 투표 목록 응답에서 PENDING, REJECTED는 그대로, 나머지는 종료 시각 기준으로 상태 계산 (#81)
1 parent d65da0f commit af5d870

File tree

1 file changed

+7
-1
lines changed
  • src/main/java/com/moa/moa_server/domain/vote/dto/response/mine

1 file changed

+7
-1
lines changed

src/main/java/com/moa/moa_server/domain/vote/dto/response/mine/MyVoteItem.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ public record MyVoteItem(
1717
) {
1818

1919
public static MyVoteItem from(Vote vote, List<VoteOptionResultWithId> results) {
20-
String status = vote.getClosedAt().isAfter(LocalDateTime.now()) ? "OPEN" : "CLOSED";
20+
String status;
21+
if (vote.getVoteStatus() == Vote.VoteStatus.REJECTED || vote.getVoteStatus() == Vote.VoteStatus.PENDING) {
22+
status = vote.getVoteStatus().name();
23+
} else {
24+
status = vote.getClosedAt().isAfter(LocalDateTime.now()) ? "OPEN" : "CLOSED";
25+
}
26+
2127
return new MyVoteItem(
2228
vote.getId(),
2329
vote.getGroup().getId(),

0 commit comments

Comments
 (0)