7430_devToTest #2490

Merged
alexm merged 306 commits from 7430_devToTest into test 2024-05-21 09:15:04 +00:00
2 changed files with 7 additions and 6 deletions
Showing only changes of commit 0709a64dca - Show all commits

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,