You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by of...@apache.org on 2020/09/16 14:13:57 UTC

[incubator-dlab] 01/01: [DLAB-1922] Fixed bug with reminder about notebook stopping continues to show up after scheduler triggering

This is an automated email from the ASF dual-hosted git repository.

ofuks pushed a commit to branch DLAB-1922
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 7026fd3a74582ced64f92dd199c002384c580ccd
Author: Oleh Fuks <ol...@gmail.com>
AuthorDate: Wed Sep 16 17:11:02 2020 +0300

    [DLAB-1922] Fixed bug with reminder about notebook stopping continues to show up after scheduler triggering
---
 .../dlab/backendapi/service/impl/SchedulerJobServiceImpl.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/SchedulerJobServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/SchedulerJobServiceImpl.java
index 4b64e0b..a929698 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/SchedulerJobServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/SchedulerJobServiceImpl.java
@@ -469,15 +469,16 @@ public class SchedulerJobServiceImpl implements SchedulerJobService {
 	}
 
 	private boolean shouldSchedulerBeExecuted(SchedulerJobDTO dto, OffsetDateTime dateTime, List<DayOfWeek> daysRepeat,
-											  LocalTime time, boolean usingOffset) {
-		LocalDateTime convertedDateTime = localDateTimeAtZone(dateTime, dto.getTimeZoneOffset());
+	                                          LocalTime time, boolean usingOffset) {
+		ZoneOffset timeZoneOffset = dto.getTimeZoneOffset();
+		LocalDateTime convertedDateTime = localDateTimeAtZone(dateTime, timeZoneOffset);
 		return isSchedulerActive(dto, convertedDateTime)
 				&& daysRepeat.contains(convertedDateTime.toLocalDate().getDayOfWeek())
-				&& timeFilter(time, convertedDateTime.toLocalTime(), usingOffset);
+				&& timeFilter(time, convertedDateTime.toLocalTime(), timeZoneOffset, usingOffset);
 	}
 
-	private boolean timeFilter(LocalTime time, LocalTime convertedDateTime, boolean usingOffset) {
-		return usingOffset ? (time.isBefore(convertedDateTime) && time.isAfter(LocalDateTime.now().toLocalTime())) :
+	private boolean timeFilter(LocalTime time, LocalTime convertedDateTime, ZoneOffset timeZoneOffset, boolean usingOffset) {
+		return usingOffset ? (time.isBefore(convertedDateTime) && time.isAfter(LocalDateTime.now(timeZoneOffset).toLocalTime())) :
 				convertedDateTime.equals(time);
 	}
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org