createLive bug fixed

This commit is contained in:
SamSys
2025-10-06 14:45:54 +03:30
parent 87cde91ad0
commit f50fdd7f91

View File

@@ -182,29 +182,30 @@ public class LeaveApplication : ILeaveApplication
shiftDuration = shiftEndDateTime - shiftStartDateTime;
hasShiftDuration = true;
}
}
else if (employeeSettings is { WorkshopShiftStatus: WorkshopShiftStatus.Irregular })
{
if ((end - start).TotalDays > 1)
else if (employeeSettings is { WorkshopShiftStatus: WorkshopShiftStatus.Irregular })
{
return op.Failed("شما نمیتوانید بیشتر از یک روز مرخصی روزانه ثبت کنید");
}
var isActive = _rollCallEmployeeStatusApplication.IsActiveInPeriod(command.EmployeeId, command.WorkshopId, start, start);
if (isActive)
{
shiftDuration = employeeSettings.IrregularShift.WorkshopIrregularShifts switch
if ((end - start).TotalDays > 1)
{
WorkshopIrregularShifts.TwelveThirtySix => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwelveTwentyFour => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwentyFourFortyEight => TimeSpan.FromHours(24),
WorkshopIrregularShifts.TwentyFourTwentyFour => TimeSpan.FromHours(24),
_ => new TimeSpan()
};
hasShiftDuration = true;
}
return op.Failed("شما نمیتوانید بیشتر از یک روز مرخصی روزانه ثبت کنید");
}
var isActive = _rollCallEmployeeStatusApplication.IsActiveInPeriod(command.EmployeeId, command.WorkshopId, start, start);
if (isActive)
{
shiftDuration = employeeSettings.IrregularShift.WorkshopIrregularShifts switch
{
WorkshopIrregularShifts.TwelveThirtySix => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwelveTwentyFour => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwentyFourFortyEight => TimeSpan.FromHours(24),
WorkshopIrregularShifts.TwentyFourTwentyFour => TimeSpan.FromHours(24),
_ => new TimeSpan()
};
hasShiftDuration = true;
}
}
}
}