From 392b2a965753bd4d532e020244a273913a1efdaf Mon Sep 17 00:00:00 2001 From: Alyona Date: Fri, 9 Nov 2018 14:51:19 +0400 Subject: [PATCH] added period event --- src/main/java/ru/ulstu/timeline/service/EventScheduler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/ulstu/timeline/service/EventScheduler.java b/src/main/java/ru/ulstu/timeline/service/EventScheduler.java index 482e201..14c1177 100644 --- a/src/main/java/ru/ulstu/timeline/service/EventScheduler.java +++ b/src/main/java/ru/ulstu/timeline/service/EventScheduler.java @@ -31,7 +31,7 @@ public class EventScheduler { public void checkPeriodEvents() { log.debug("EventScheduler.checkPeriodEvents started"); for (Event event : eventRepository.findAll()) { - if(halfOfThePariodHasPassed(event)){ + if(halfOfThePeriodHasPassed(event)){ event.setCreateDate(Date.from((LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant()))); event.setBeginDate(DateUtils.addDays(event.getBeginDate(), event.getPeriod().getPeriod().getDays())); event.setUpdateDate(null); @@ -53,7 +53,7 @@ public class EventScheduler { log.debug("EventScheduler.checkPeriodEvents finished"); } - private boolean halfOfThePariodHasPassed(Event event){ + private boolean halfOfThePeriodHasPassed(Event event){ if (Period.between(event.getBeginDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now()).getDays() <= event.getPeriod().getPeriod().getDays() / 2) { return true;