Skip to content

Commit

Permalink
🔨 [Refactor] 토너먼트 진행 시간동안의 슬롯 블락 로직 삭제 (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimhan-nah authored Jan 20, 2024
1 parent ed1d638 commit 72d0406
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
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
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

0 comments on commit 72d0406

Please sign in to comment.