workflow Holidays bug fixed

This commit is contained in:
SamSys
2025-01-15 19:18:47 +03:30
parent 59e2c1a5e4
commit ac811c93bd
3 changed files with 6 additions and 4 deletions

View File

@@ -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("کارمند در بازه وارد شده غیر فعال است");

View File

@@ -89,7 +89,8 @@ public class HolidayItemRepository : RepositoryBase<long, HolidayItem>, 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));

View File

@@ -792,9 +792,10 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
{
List<RollCallEmployee> 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<long, RollCall>, IRollCallRepos
Id = x.id,
WorkshopId = x.WorkshopId
}),
IsHoliday = _holidayItemApplication.IsHoliday(day),
IsHoliday = isHoliday,
IsFriday = day.DayOfWeek == DayOfWeek.Friday
};
result.Add(item);