Skip to content

Commit

Permalink
Merge pull request #191 from TEAM-SAMSION/PET-278
Browse files Browse the repository at this point in the history
PET-278 fix : 크리스마스 이벤트 기간 연장
  • Loading branch information
tlarbals824 authored Dec 25, 2023
2 parents a8eaeca + 489a96c commit f4e939e
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@
public class ChristmasEventService {
private static final String EVENT_CATEGORY_NAME = "크리스마스";
private static final String EVENT_TODO_DESCRIPTION = "포잇스마스 이벤트 참여하기";
private static final List<LocalDate> EVENT_TODO_SCHEDULED_DATE_LIST = List.of(
LocalDate.of(2023, 12, 23),
LocalDate.of(2023, 12, 24),
LocalDate.of(2023, 12, 25)
);

private static final LocalDate EVENT_START_DATE = LocalDate.of(2023, 12, 23);
private static final LocalDate EVENT_END_DATE = LocalDate.of(2024, 1, 2);

private static final Long EVENT_CREATOR_ID = -1L;
private final CategoryRepository categoryRepository;
Expand All @@ -47,7 +43,9 @@ public void publishEvent(TodoTeam todoTeam){
final List<Register> allRegisters = registerRepository.findAllByTodoTeamId(todoTeam.getId());
final List<Todo> eventTodoList = new ArrayList<>();
final List<Assign> eventAssignList = new ArrayList<>();
EVENT_TODO_SCHEDULED_DATE_LIST

final List<LocalDate> eventDateList = EVENT_START_DATE.datesUntil(EVENT_END_DATE).toList();
eventDateList
.forEach(eventDate -> {
final Todo todo = Todo.builder()
.category(saved)
Expand Down Expand Up @@ -84,7 +82,8 @@ public void addNewRegisterAtChristmasEventTodo(Long todoTeamId, Long userId){
}

public Boolean isEventDay(){
return EVENT_TODO_SCHEDULED_DATE_LIST.contains(LocalDate.now());
final LocalDate now = LocalDate.now();
return now.isAfter(EVENT_START_DATE) && now.isBefore(EVENT_END_DATE);
}

}

0 comments on commit f4e939e

Please sign in to comment.