refs #6882 fix back
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-05-08 12:05:47 +02:00
parent 269c42e5c9
commit 0709a64dca
2 changed files with 7 additions and 6 deletions

View File

@ -27,7 +27,7 @@ describe('Worker calendar path', () => {
});
describe('as hr', () => {
it('should set two days as holidays on the calendar and check the total holidays increased by 1', async() => {
it('should set two days as holidays on the calendar and check the total holidays increased by 1.5', async() => {
await page.waitToClick(selectors.workerCalendar.holidays);
await page.waitForTimeout(reasonableTimeBetweenClicks);
await page.click(selectors.workerCalendar.penultimateMondayOfJanuary);
@ -56,7 +56,7 @@ describe('Worker calendar path', () => {
await page.waitForTimeout(reasonableTimeBetweenClicks);
await page.click(selectors.workerCalendar.secondFridayOfJun);
expect(await page.getProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText')).toContain(' 1 ');
expect(await page.getProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText')).toContain(' 1.5 ');
});
});

View File

@ -95,6 +95,9 @@ module.exports = Self => {
const hasHalfHoliday = result.halfHolidayCounter > 0;
const isHalfHoliday = absenceType.code === 'halfHoliday';
if (isHalfHoliday && hasHalfHoliday)
throw new UserError(`Cannot add more than one '1/2 day vacation`);
const isFestive = absenceType.isFestiveEligible;
const workCenter = await models.Business.findOne({
@ -106,13 +109,11 @@ module.exports = Self => {
dated: args.dated,
workCenterFk: workCenter.workCenterFk
}
},);
});
if (holiday && isFestive)
throw new UserError(`Cannot add holidays on this day`);
if (isHalfHoliday && (hasHalfHoliday || isFestive))
throw new UserError(`Cannot add more than one '1/2 day vacation`);
const absence = await models.Calendar.create({
businessFk: labour.businessFk,
dayOffTypeFk: args.absenceTypeId,