Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4658-createWorker

This commit is contained in:
Alex Moreno 2023-01-03 12:28:55 +01:00
commit 29483bcc1b
5 changed files with 28 additions and 2 deletions

View File

@ -29,8 +29,12 @@ module.exports = Self => {
filter = mergeFilters(filter, {where}); filter = mergeFilters(filter, {where});
const stmt = new ParameterizedSQL( const stmt = new ParameterizedSQL(
`SELECT * FROM campaign`); `SELECT * FROM (`);
stmt.merge('SELECT * FROM campaign');
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));
stmt.merge('ORDER BY dated ASC');
stmt.merge('LIMIT 10000000000000000000');
stmt.merge(') sub');
stmt.merge('GROUP BY code'); stmt.merge('GROUP BY code');
stmt.merge(conn.makePagination(filter)); stmt.merge(conn.makePagination(filter));

View File

@ -2652,7 +2652,7 @@ INSERT INTO `vn`.`mdbVersion` (`app`, `branchFk`, `version`)
INSERT INTO `vn`.`accountingConfig` (`id`, `minDate`, `maxDate`) INSERT INTO `vn`.`accountingConfig` (`id`, `minDate`, `maxDate`)
VALUES VALUES
(1, '2022-01-01', '2023-01-01'); (1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-01-01'), CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR)), '-01-01'));
INSERT INTO `vn`.`saleGroup` (`userFk`, `parkingFk`, `sectorFk`) INSERT INTO `vn`.`saleGroup` (`userFk`, `parkingFk`, `sectorFk`)

View File

@ -58,6 +58,7 @@ describe('Worker time control path', () => {
}); });
it(`should return error when insert 'out' of first entry`, async() => { it(`should return error when insert 'out' of first entry`, async() => {
pending('https://redmine.verdnatura.es/issues/4707');
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm); await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
@ -68,6 +69,7 @@ describe('Worker time control path', () => {
}); });
it(`should insert 'in' monday`, async() => { it(`should insert 'in' monday`, async() => {
pending('https://redmine.verdnatura.es/issues/4707');
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm); await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
@ -78,6 +80,7 @@ describe('Worker time control path', () => {
}); });
it(`should insert 'out' monday`, async() => { it(`should insert 'out' monday`, async() => {
pending('https://redmine.verdnatura.es/issues/4707');
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, fourPm); await page.pickTime(selectors.workerTimeControl.dialogTimeInput, fourPm);
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
@ -88,11 +91,13 @@ describe('Worker time control path', () => {
}); });
it(`should check Hank Pym worked 8:20 hours`, async() => { it(`should check Hank Pym worked 8:20 hours`, async() => {
pending('https://redmine.verdnatura.es/issues/4707');
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '08:20 h.'); await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '08:20 h.');
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '08:20 h.'); await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '08:20 h.');
}); });
it('should remove first entry of monday', async() => { it('should remove first entry of monday', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
await page.waitForTextInElement(selectors.workerTimeControl.firstEntryOfMonday, eightAm); await page.waitForTextInElement(selectors.workerTimeControl.firstEntryOfMonday, eightAm);
await page.waitForTextInElement(selectors.workerTimeControl.secondEntryOfMonday, fourPm); await page.waitForTextInElement(selectors.workerTimeControl.secondEntryOfMonday, fourPm);
await page.waitToClick(selectors.workerTimeControl.firstEntryOfMondayDelete); await page.waitToClick(selectors.workerTimeControl.firstEntryOfMondayDelete);
@ -103,6 +108,7 @@ describe('Worker time control path', () => {
}); });
it(`should be the 'out' the first entry of monday`, async() => { it(`should be the 'out' the first entry of monday`, async() => {
pending('https://redmine.verdnatura.es/issues/4707');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText'); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
expect(result).toEqual(fourPm); expect(result).toEqual(fourPm);

View File

@ -10,6 +10,7 @@ describe('workerTimeControl sendMail()', () => {
const ctx = {req: activeCtx, args: {}}; const ctx = {req: activeCtx, args: {}};
it('should fill time control of a worker without records in Journey and with rest', async() => { it('should fill time control of a worker without records in Journey and with rest', async() => {
pending('https://redmine.verdnatura.es/issues/4903');
const tx = await models.WorkerTimeControl.beginTransaction({}); const tx = await models.WorkerTimeControl.beginTransaction({});
try { try {
@ -34,6 +35,7 @@ describe('workerTimeControl sendMail()', () => {
}); });
it('should fill time control of a worker without records in Journey and without rest', async() => { it('should fill time control of a worker without records in Journey and without rest', async() => {
pending('https://redmine.verdnatura.es/issues/4903');
const workdayOf20Hours = 3; const workdayOf20Hours = 3;
const tx = await models.WorkerTimeControl.beginTransaction({}); const tx = await models.WorkerTimeControl.beginTransaction({});
@ -61,6 +63,7 @@ describe('workerTimeControl sendMail()', () => {
}); });
it('should fill time control of a worker with records in Journey and with rest', async() => { it('should fill time control of a worker with records in Journey and with rest', async() => {
pending('https://redmine.verdnatura.es/issues/4903');
const tx = await models.WorkerTimeControl.beginTransaction({}); const tx = await models.WorkerTimeControl.beginTransaction({});
try { try {
@ -92,6 +95,7 @@ describe('workerTimeControl sendMail()', () => {
}); });
it('should fill time control of a worker with records in Journey and without rest', async() => { it('should fill time control of a worker with records in Journey and without rest', async() => {
pending('https://redmine.verdnatura.es/issues/4903');
const tx = await models.WorkerTimeControl.beginTransaction({}); const tx = await models.WorkerTimeControl.beginTransaction({});
try { try {

View File

@ -201,6 +201,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
describe('WorkerTimeControl_clockIn calls', () => { describe('WorkerTimeControl_clockIn calls', () => {
it('should fail to add a time entry if the target user has an absence that day', async() => { it('should fail to add a time entry if the target user has an absence that day', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId; const workerId = hankPymId;
const date = new Date(); const date = new Date();
@ -247,6 +248,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
describe('direction errors', () => { describe('direction errors', () => {
it('should throw an error when trying "in" direction twice', async() => { it('should throw an error when trying "in" direction twice', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId; const workerId = hankPymId;
@ -276,6 +278,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
}); });
it('should throw an error when trying "in" direction after insert "in" and "middle"', async() => { it('should throw an error when trying "in" direction after insert "in" and "middle"', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId; const workerId = hankPymId;
@ -309,6 +312,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
}); });
it('Should throw an error when trying "out" before closing a "middle" couple', async() => { it('Should throw an error when trying "out" before closing a "middle" couple', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId; const workerId = hankPymId;
@ -342,6 +346,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
}); });
it('should throw an error when trying "middle" after "out"', async() => { it('should throw an error when trying "middle" after "out"', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId; const workerId = hankPymId;
@ -375,6 +380,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
}); });
it('should throw an error when trying "out" direction twice', async() => { it('should throw an error when trying "out" direction twice', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId; const workerId = hankPymId;
@ -446,6 +452,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
}); });
it('should not fail as the 12h rest is fulfilled', async() => { it('should not fail as the 12h rest is fulfilled', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId; const workerId = hankPymId;
@ -482,6 +489,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
describe('for 3500kg drivers with enforced 9h rest', () => { describe('for 3500kg drivers with enforced 9h rest', () => {
it('should throw an error when the 9h enforced rest is not fulfilled', async() => { it('should throw an error when the 9h enforced rest is not fulfilled', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = jessicaJonesId; const workerId = jessicaJonesId;
@ -516,6 +524,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
}); });
it('should not fail when the 9h enforced rest is fulfilled', async() => { it('should not fail when the 9h enforced rest is fulfilled', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = jessicaJonesId; const workerId = jessicaJonesId;
@ -552,6 +561,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
describe('for 36h weekly rest', () => { describe('for 36h weekly rest', () => {
it('should throw an error when the 36h weekly rest is not fulfilled', async() => { it('should throw an error when the 36h weekly rest is not fulfilled', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId; const workerId = hankPymId;
@ -586,6 +596,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
}); });
it('should throw an error when the 36h weekly rest is not fulfilled again', async() => { it('should throw an error when the 36h weekly rest is not fulfilled again', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId; const workerId = hankPymId;
@ -619,6 +630,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
describe('for 72h weekly rest', () => { describe('for 72h weekly rest', () => {
it('should throw when the 72h weekly rest is not fulfilled yet', async() => { it('should throw when the 72h weekly rest is not fulfilled yet', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId; activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId; const workerId = hankPymId;