-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
130 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
backend/src/main/java/ddangkong/domain/room/balance/roomvote/VotingStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package ddangkong.domain.room.balance.roomvote; | ||
|
||
import ddangkong.domain.balance.option.BalanceOptions; | ||
import ddangkong.domain.room.member.Member; | ||
import ddangkong.domain.room.member.RoomMembers; | ||
import java.util.List; | ||
import lombok.Getter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Slf4j | ||
public class VotingStatus { | ||
|
||
private final RoomMembers roomMembers; | ||
private final BalanceOptions balanceOptions; | ||
private final int voteCount; | ||
private final boolean isVoteFinished; | ||
|
||
public VotingStatus(RoomMembers roomMembers, | ||
BalanceOptions balanceOptions, | ||
int voteCount, | ||
boolean isVoteFinished) { | ||
checkVoteSize(roomMembers, voteCount); | ||
|
||
this.roomMembers = roomMembers; | ||
this.balanceOptions = balanceOptions; | ||
this.voteCount = voteCount; | ||
this.isVoteFinished = isVoteFinished; | ||
} | ||
|
||
private void checkVoteSize(RoomMembers roomMembers, int voteCount) { | ||
if (voteCount > roomMembers.size()) { | ||
log.error("[Concurrency Error] 투표한 인원 수가 방 인원 수보다 많습니다. 투표한 인원 수: {}, 방 인원 수: {}", | ||
voteCount, roomMembers.size()); | ||
} | ||
} | ||
|
||
public Member getMember(Long memberId) { | ||
return roomMembers.getMember(memberId); | ||
} | ||
|
||
public List<Member> getMembers() { | ||
return roomMembers.getMembers(); | ||
} | ||
|
||
public int getMemberCount() { | ||
return roomMembers.size(); | ||
} | ||
|
||
public boolean isVoteNotFinished() { | ||
return !isVoteFinished; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
backend/src/main/java/ddangkong/facade/room/balance/roomvote/context/VoteContext.java
This file was deleted.
Oops, something went wrong.
10 changes: 9 additions & 1 deletion
10
backend/src/main/java/ddangkong/facade/room/balance/roomvote/dto/VoteFinishedResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
package ddangkong.facade.room.balance.roomvote.dto; | ||
|
||
import ddangkong.domain.room.balance.roomvote.VotingStatus; | ||
|
||
public record VoteFinishedResponse( | ||
boolean isFinished | ||
boolean isFinished, | ||
int memberCount, | ||
int voteCount | ||
) { | ||
|
||
public VoteFinishedResponse(VotingStatus status) { | ||
this(status.isVoteFinished(), status.getMemberCount(), status.getVoteCount()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.