| @@ -278,27 +278,34 @@ open class MailReminderService( | |||||
| var daysBefore: LocalDate = today.minusDays(1) | var daysBefore: LocalDate = today.minusDays(1) | ||||
| val workingDaysList = mutableListOf<LocalDate>() | val workingDaysList = mutableListOf<LocalDate>() | ||||
| while (daysChecking <= 10) { | while (daysChecking <= 10) { | ||||
| // println("daysChecking: $daysChecking --- daysBefore: $daysBefore") | |||||
| // Check the working days within 7 days to 10 days before | |||||
| if (!allHolidaysList.contains(daysBefore) && daysBefore.dayOfWeek != DayOfWeek.SATURDAY && daysBefore.dayOfWeek != DayOfWeek.SUNDAY) { | if (!allHolidaysList.contains(daysBefore) && daysBefore.dayOfWeek != DayOfWeek.SATURDAY && daysBefore.dayOfWeek != DayOfWeek.SUNDAY) { | ||||
| if (daysChecking in 7 .. 10) { | if (daysChecking in 7 .. 10) { | ||||
| workingDaysList.add(daysBefore) | workingDaysList.add(daysBefore) | ||||
| } | } | ||||
| // 7 days before | |||||
| if (daysChecking == 7) { | |||||
| sevenDaysBefore = daysBefore | |||||
| } | |||||
| else if (daysChecking == 10) { // 10 days before | |||||
| tenDaysBefore = daysBefore | |||||
| break | |||||
| } | |||||
| } | } | ||||
| // 7 days before | |||||
| // if (daysChecking == 7) { | |||||
| // println("=7 $daysBefore") | |||||
| // sevenDaysBefore = daysBefore | |||||
| // } | |||||
| // // 10 days before | |||||
| // if (daysChecking == 10) { | |||||
| // println("=10 $daysBefore") | |||||
| // tenDaysBefore = daysBefore | |||||
| // } | |||||
| daysChecking ++ | daysChecking ++ | ||||
| daysBefore = daysBefore.minusDays(1) | daysBefore = daysBefore.minusDays(1) | ||||
| } | } | ||||
| // println("-------- $workingDaysList ---------") | |||||
| // println(workingDaysList.first()) | |||||
| // println(workingDaysList.last()) | |||||
| val args = mutableMapOf( | val args = mutableMapOf( | ||||
| "from" to tenDaysBefore, | |||||
| "to" to sevenDaysBefore, | |||||
| "from" to workingDaysList.last(), | |||||
| "to" to workingDaysList.first(), | |||||
| ) | ) | ||||
| val ts = timesheetsService.workHourRecordsWithinRange(args) | val ts = timesheetsService.workHourRecordsWithinRange(args) | ||||