From ac811c93bd7382e6f1dd2ed72183a588f142fe58 Mon Sep 17 00:00:00 2001 From: SamSys Date: Wed, 15 Jan 2025 19:18:47 +0330 Subject: [PATCH] workflow Holidays bug fixed --- CompanyManagment.Application/RollCallApplication.cs | 2 +- CompanyManagment.EFCore/Repository/HolidayItemRepository.cs | 3 ++- CompanyManagment.EFCore/Repository/RollCallRepository.cs | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CompanyManagment.Application/RollCallApplication.cs b/CompanyManagment.Application/RollCallApplication.cs index 7f8bdc0e..78317211 100644 --- a/CompanyManagment.Application/RollCallApplication.cs +++ b/CompanyManagment.Application/RollCallApplication.cs @@ -554,7 +554,7 @@ public class RollCallApplication : IRollCallApplication //--- - if (result == null || !result.All(x => employeeStatuses.Any(y => x.Start >= y.StartDateGr || x.End <= y.EndDateGr))) + if (result == null || !result.All(newRollcall => employeeStatuses.Any(status => newRollcall.Start >= status.StartDateGr && newRollcall.End <= status.EndDateGr))) return operation.Failed("کارمند در بازه وارد شده غیر فعال است"); diff --git a/CompanyManagment.EFCore/Repository/HolidayItemRepository.cs b/CompanyManagment.EFCore/Repository/HolidayItemRepository.cs index d002f86c..8c7d9ff6 100644 --- a/CompanyManagment.EFCore/Repository/HolidayItemRepository.cs +++ b/CompanyManagment.EFCore/Repository/HolidayItemRepository.cs @@ -89,7 +89,8 @@ public class HolidayItemRepository : RepositoryBase, IHoliday Id = x.id, Holidaydate = x.Holidaydate.ToFarsi(), HolidayId = x.HolidayId, - HolidayYear = x.HolidayYear + HolidayYear = x.HolidayYear, + HolidaydateGr = x.Holidaydate }); if (!string.IsNullOrWhiteSpace(searchModel.HolidayYear)) query = query.Where(x => x.HolidayYear.Contains(searchModel.HolidayYear)); diff --git a/CompanyManagment.EFCore/Repository/RollCallRepository.cs b/CompanyManagment.EFCore/Repository/RollCallRepository.cs index 89025bf4..f05dbb92 100644 --- a/CompanyManagment.EFCore/Repository/RollCallRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallRepository.cs @@ -792,9 +792,10 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos { List activatedEmployeesListInDay = new(); + bool isHoliday = totalHolidays.Any(x => x.HolidaydateGr == day); //in working days everyone should be present - if (day.DayOfWeek != DayOfWeek.Friday && totalHolidays.All(x => x.HolidaydateGr != day)) + if (day.DayOfWeek != DayOfWeek.Friday && !isHoliday) { activatedEmployeesListInDay = activatedEmployeesList; } @@ -832,7 +833,7 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos Id = x.id, WorkshopId = x.WorkshopId }), - IsHoliday = _holidayItemApplication.IsHoliday(day), + IsHoliday = isHoliday, IsFriday = day.DayOfWeek == DayOfWeek.Friday }; result.Add(item);