Merge remote-tracking branch 'origin/Fix/CustomizeCheckout/Change31DaysTo30'

This commit is contained in:
SamSys
2025-04-21 15:44:20 +03:30
4 changed files with 12 additions and 12 deletions

View File

@@ -25,7 +25,7 @@ public interface IRollCallDomainService
long workshopId);
TimeOnly GetEmployeeOffSetForRegularSettings(long employeeId, long workshopId);
DateTime GetEmployeeShiftDateByRollCallStartDate(long workshopId, long employeeId, DateTime rollCallStartDate);
DateTime GetEmployeeShiftDateByRollCallStartDate(long workshopId, long employeeId, DateTime rollCallStartDate,DateTime rollCallEndDate);
void CalculateTimeDifferences(RollCall rollCall);
@@ -173,16 +173,16 @@ public class RollCallDomainService : IRollCallDomainService
}
public DateTime GetEmployeeShiftDateByRollCallStartDate(long workshopId, long employeeId,
DateTime rollCallStartDate)
DateTime rollCallStartDate,DateTime rollCallEndDate)
{
var shiftDetails = GetEmployeeShiftDetails(employeeId, workshopId);
var offset = GetEmployeeOffSetForRegularSettings(employeeId, workshopId);
return shiftDetails.shiftType switch
{
WorkshopShiftStatus.Regular => CalculateRegularShiftDate(rollCallStartDate, offset),
WorkshopShiftStatus.Rotating => rollCallStartDate.Date,
WorkshopShiftStatus.Rotating => FindRotatingShift(rollCallEndDate,rollCallEndDate,shiftDetails.rotatingShifts).start.Date,
WorkshopShiftStatus.Irregular => rollCallStartDate.Date,
_ => throw new ArgumentOutOfRangeException()
};

View File

@@ -27,8 +27,6 @@ namespace Company.Domain.RollCallAgg
Month = month;
RollCallModifyType = rollCallModifyType;
SetShiftDate(service);
var shiftDetails = service.GetEmployeeShiftDetails(employeeId, workshopId);
if (shiftDetails is { shiftType: WorkshopShiftStatus.Irregular, irregularShift: null } or
@@ -229,6 +227,8 @@ namespace Company.Domain.RollCallAgg
{
EndDate = endDate;
SetShiftDate(service);
ShiftDurationTimeSpan = CalculateShiftDuration(StartDate!.Value, EndDate.Value, service);
NightWorkTimeSpan = CalculateNightWorkDuration(StartDate.Value, endDate);
@@ -278,7 +278,7 @@ namespace Company.Domain.RollCallAgg
private void SetShiftDate(IRollCallDomainService service)
{
ShiftDate = service.GetEmployeeShiftDateByRollCallStartDate(WorkshopId, EmployeeId, StartDate!.Value);
ShiftDate = service.GetEmployeeShiftDateByRollCallStartDate(WorkshopId, EmployeeId, StartDate!.Value,EndDate.Value);
}
private TimeSpan CalculateShiftDuration(DateTime startRollCall, DateTime endRollCall, IRollCallDomainService service)

View File

@@ -447,7 +447,7 @@ public class RollCallApplication : IRollCallApplication
{
x.ShiftDate =
_rollCallDomainService.GetEmployeeShiftDateByRollCallStartDate(command.WorkshopId, command.EmployeeId,
x.StartDate!.Value);
x.StartDate!.Value,x.EndDate!.Value);
});
if (newRollCallDates.Any(x => x.ShiftDate.Date != date.Date))
@@ -618,7 +618,7 @@ public class RollCallApplication : IRollCallApplication
{
x.ShiftDate =
_rollCallDomainService.GetEmployeeShiftDateByRollCallStartDate(command.WorkshopId, command.EmployeeId,
x.StartDate!.Value);
x.StartDate!.Value,x.EndDate!.Value);
});
if (newRollCallDates.Any(x => x.ShiftDate.Date != date.Date))
{

View File

@@ -51,15 +51,15 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
//var notEndedRollCalls = rollCalls.Where(x => x.EndDate == null).ToList();
//RefactorAllTheRollCallsOnEsfand(endedRollCalls, notEndedRollCalls);
CreateRewardForKebabMahdi().GetAwaiter().GetResult();
//CreateRewardForKebabMahdi().GetAwaiter().GetResult();
ViewData["message"] = "ایجاد شد";
return Page();
}
public IActionResult OnPostShiftDateNew()
{
var startRollCall = new DateTime(2025, 2, 19);
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.WorkshopId == 170).ToList();
var startRollCall = new DateTime(2025, 3, 21);
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.WorkshopId == 170 ).ToList();
var r1 = rollCalls.Take(3000).ToList();
Console.ForegroundColor = ConsoleColor.DarkRed;