Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔨 [Refactor] 토너먼트 진행 시간동안의 슬롯 블락 로직 삭제 #488

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ public SlotStatusResponseListDto getAllMatchStatus(UserDto userDto, Option optio
List<Game> games = gameRepository.findAllBetween(slotGenerator.getNow(), slotGenerator.getMaxTime());
slotGenerator.addPastSlots();
slotGenerator.addMatchedSlots(games);
List<Tournament> tournaments = tournamentRepository.findAllByStatusIsNot(TournamentStatus.END);
slotGenerator.addTournamentSlots(tournaments);

Optional<Game> myGame = gameRepository.findByStatusTypeAndUserId(StatusType.BEFORE, userDto.getId());
Set<LocalDateTime> gameTimes = games.stream().map(Game::getStartTime).collect(Collectors.toSet());
Expand Down
19 changes: 0 additions & 19 deletions src/main/java/com/gg/server/domain/match/utils/SlotGenerator.java
SONGS4RI marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,6 @@ public void addMatchedSlots(List<Game> games) {
new SlotStatusDto(e.getStartTime(), SlotStatus.CLOSE, interval)));
}

/**
* BEFORE, LIVE 상태의 토너먼트 진행 시간에 슬롯을 block함
*/
public void addTournamentSlots(List<Tournament> tournaments) {
for (Tournament tournament : tournaments) {
LocalDateTime startTime = tournament.getStartTime();
int startTimeMinute = startTime.getMinute();
startTimeMinute = startTimeMinute - (startTimeMinute % interval);
startTime = startTime.withMinute(startTimeMinute);
LocalDateTime endTime = tournament.getEndTime();
int endTimeMinute = endTime.getMinute();
endTimeMinute = endTimeMinute + (interval - (endTimeMinute % interval));
endTime = endTime.withMinute(endTimeMinute);
for (LocalDateTime time = startTime; time.isBefore(endTime); time = time.plusMinutes(interval)) {
slots.put(time, new SlotStatusDto(time, SlotStatus.CLOSE, interval));
}
}
}

public void addMySlots(Game myGame) {
slots.put(myGame.getStartTime(),
new SlotStatusDto(myGame.getStartTime(), myGame.getEndTime(),
Expand Down
Loading