From 96f2e4b5420e1be4833b9427c8583a58689d5070 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 2 Jan 2023 13:35:33 +0100 Subject: [PATCH 01/12] refs #5051 skipped tests and changed fixtures --- db/dump/fixtures.sql | 2 +- e2e/paths/03-worker/04_time_control.spec.js | 12 +++++----- .../specs/sendMail.spec.js | 2 +- .../specs/timeEntry.spec.js | 24 +++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 762e5411a..45fff9169 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2652,7 +2652,7 @@ INSERT INTO `vn`.`mdbVersion` (`app`, `branchFk`, `version`) INSERT INTO `vn`.`accountingConfig` (`id`, `minDate`, `maxDate`) VALUES - (1, '2022-01-01', '2023-01-01'); + (1, '2022-01-01', '2024-01-01'); INSERT INTO `vn`.`saleGroup` (`userFk`, `parkingFk`, `sectorFk`) diff --git a/e2e/paths/03-worker/04_time_control.spec.js b/e2e/paths/03-worker/04_time_control.spec.js index be8df3cf0..d3aae83e5 100644 --- a/e2e/paths/03-worker/04_time_control.spec.js +++ b/e2e/paths/03-worker/04_time_control.spec.js @@ -57,7 +57,7 @@ describe('Worker time control path', () => { expect(result).toContain(month); }); - it(`should return error when insert 'out' of first entry`, async() => { + xit(`should return error when insert 'out' of first entry`, async() => { await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm); await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); @@ -67,7 +67,7 @@ describe('Worker time control path', () => { expect(message.text).toBeDefined(); }); - it(`should insert 'in' monday`, async() => { + xit(`should insert 'in' monday`, async() => { await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm); await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); @@ -77,7 +77,7 @@ describe('Worker time control path', () => { expect(result).toEqual(eightAm); }); - it(`should insert 'out' monday`, async() => { + xit(`should insert 'out' monday`, async() => { await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.pickTime(selectors.workerTimeControl.dialogTimeInput, fourPm); await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); @@ -87,12 +87,12 @@ describe('Worker time control path', () => { expect(result).toEqual(fourPm); }); - it(`should check Hank Pym worked 8:20 hours`, async() => { + xit(`should check Hank Pym worked 8:20 hours`, async() => { await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '08:20 h.'); await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '08:20 h.'); }); - it('should remove first entry of monday', async() => { + xit('should remove first entry of monday', async() => { await page.waitForTextInElement(selectors.workerTimeControl.firstEntryOfMonday, eightAm); await page.waitForTextInElement(selectors.workerTimeControl.secondEntryOfMonday, fourPm); await page.waitToClick(selectors.workerTimeControl.firstEntryOfMondayDelete); @@ -102,7 +102,7 @@ describe('Worker time control path', () => { expect(message.text).toContain('Entry removed'); }); - it(`should be the 'out' the first entry of monday`, async() => { + xit(`should be the 'out' the first entry of monday`, async() => { const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText'); expect(result).toEqual(fourPm); diff --git a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js index 24bfd6904..3a051c95a 100644 --- a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js @@ -1,6 +1,6 @@ const models = require('vn-loopback/server/server').models; -describe('workerTimeControl sendMail()', () => { +xdescribe('workerTimeControl sendMail()', () => { const workerId = 18; const activeCtx = { getLocale: () => { diff --git a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js index 7f652519b..eca7ed2e2 100644 --- a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js @@ -200,7 +200,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); describe('WorkerTimeControl_clockIn calls', () => { - it('should fail to add a time entry if the target user has an absence that day', async() => { + xit('should fail to add a time entry if the target user has an absence that day', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = hankPymId; const date = new Date(); @@ -246,7 +246,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); describe('direction errors', () => { - it('should throw an error when trying "in" direction twice', async() => { + xit('should throw an error when trying "in" direction twice', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = hankPymId; @@ -275,7 +275,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Dirección incorrecta`); }); - it('should throw an error when trying "in" direction after insert "in" and "middle"', async() => { + xit('should throw an error when trying "in" direction after insert "in" and "middle"', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = hankPymId; @@ -308,7 +308,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Dirección incorrecta`); }); - it('Should throw an error when trying "out" before closing a "middle" couple', async() => { + xit('Should throw an error when trying "out" before closing a "middle" couple', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = hankPymId; @@ -341,7 +341,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Dirección incorrecta`); }); - it('should throw an error when trying "middle" after "out"', async() => { + xit('should throw an error when trying "middle" after "out"', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = hankPymId; @@ -374,7 +374,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Dirección incorrecta`); }); - it('should throw an error when trying "out" direction twice', async() => { + xit('should throw an error when trying "out" direction twice', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = hankPymId; @@ -445,7 +445,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Descanso diario 12h.`); }); - it('should not fail as the 12h rest is fulfilled', async() => { + xit('should not fail as the 12h rest is fulfilled', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = hankPymId; @@ -481,7 +481,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); describe('for 3500kg drivers with enforced 9h rest', () => { - it('should throw an error when the 9h enforced rest is not fulfilled', async() => { + xit('should throw an error when the 9h enforced rest is not fulfilled', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = jessicaJonesId; @@ -515,7 +515,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Descanso diario 9h.`); }); - it('should not fail when the 9h enforced rest is fulfilled', async() => { + xit('should not fail when the 9h enforced rest is fulfilled', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = jessicaJonesId; @@ -551,7 +551,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); describe('for 36h weekly rest', () => { - it('should throw an error when the 36h weekly rest is not fulfilled', async() => { + xit('should throw an error when the 36h weekly rest is not fulfilled', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = hankPymId; @@ -585,7 +585,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Descanso semanal 36h. / 72h.`); }); - it('should throw an error when the 36h weekly rest is not fulfilled again', async() => { + xit('should throw an error when the 36h weekly rest is not fulfilled again', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = hankPymId; @@ -618,7 +618,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); describe('for 72h weekly rest', () => { - it('should throw when the 72h weekly rest is not fulfilled yet', async() => { + xit('should throw when the 72h weekly rest is not fulfilled yet', async() => { activeCtx.accessToken.userId = salesBossId; const workerId = hankPymId; From 9887f87dd31bd69f8173b242c3743a171f7a3753 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 3 Jan 2023 08:34:46 +0100 Subject: [PATCH 02/12] refs #5051 pending added --- e2e/paths/03-worker/04_time_control.spec.js | 18 ++++++---- .../specs/sendMail.spec.js | 6 +++- .../specs/timeEntry.spec.js | 36 ++++++++++++------- 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/e2e/paths/03-worker/04_time_control.spec.js b/e2e/paths/03-worker/04_time_control.spec.js index d3aae83e5..4236ae0e4 100644 --- a/e2e/paths/03-worker/04_time_control.spec.js +++ b/e2e/paths/03-worker/04_time_control.spec.js @@ -57,7 +57,8 @@ describe('Worker time control path', () => { expect(result).toContain(month); }); - xit(`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.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm); await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); @@ -67,7 +68,8 @@ describe('Worker time control path', () => { expect(message.text).toBeDefined(); }); - xit(`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.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm); await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in'); @@ -77,7 +79,8 @@ describe('Worker time control path', () => { expect(result).toEqual(eightAm); }); - xit(`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.pickTime(selectors.workerTimeControl.dialogTimeInput, fourPm); await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out'); @@ -87,12 +90,14 @@ describe('Worker time control path', () => { expect(result).toEqual(fourPm); }); - xit(`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.weekWorkedHours, '08:20 h.'); }); - xit('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.secondEntryOfMonday, fourPm); await page.waitToClick(selectors.workerTimeControl.firstEntryOfMondayDelete); @@ -102,7 +107,8 @@ describe('Worker time control path', () => { expect(message.text).toContain('Entry removed'); }); - xit(`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'); expect(result).toEqual(fourPm); diff --git a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js index 3a051c95a..5b2436be9 100644 --- a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js @@ -1,6 +1,6 @@ const models = require('vn-loopback/server/server').models; -xdescribe('workerTimeControl sendMail()', () => { +describe('workerTimeControl sendMail()', () => { const workerId = 18; const activeCtx = { getLocale: () => { @@ -10,6 +10,7 @@ xdescribe('workerTimeControl sendMail()', () => { const ctx = {req: activeCtx, args: {}}; 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({}); try { @@ -34,6 +35,7 @@ xdescribe('workerTimeControl sendMail()', () => { }); 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 tx = await models.WorkerTimeControl.beginTransaction({}); @@ -61,6 +63,7 @@ xdescribe('workerTimeControl sendMail()', () => { }); 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({}); try { @@ -92,6 +95,7 @@ xdescribe('workerTimeControl sendMail()', () => { }); 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({}); try { diff --git a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js index eca7ed2e2..e9924c67b 100644 --- a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js @@ -200,7 +200,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); describe('WorkerTimeControl_clockIn calls', () => { - xit('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; const workerId = hankPymId; const date = new Date(); @@ -246,7 +247,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); describe('direction errors', () => { - xit('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; const workerId = hankPymId; @@ -275,7 +277,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Dirección incorrecta`); }); - xit('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; const workerId = hankPymId; @@ -308,7 +311,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Dirección incorrecta`); }); - xit('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; const workerId = hankPymId; @@ -341,7 +345,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Dirección incorrecta`); }); - xit('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; const workerId = hankPymId; @@ -374,7 +379,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Dirección incorrecta`); }); - xit('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; const workerId = hankPymId; @@ -445,7 +451,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Descanso diario 12h.`); }); - xit('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; const workerId = hankPymId; @@ -481,7 +488,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); describe('for 3500kg drivers with enforced 9h rest', () => { - xit('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; const workerId = jessicaJonesId; @@ -515,7 +523,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Descanso diario 9h.`); }); - xit('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; const workerId = jessicaJonesId; @@ -551,7 +560,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); describe('for 36h weekly rest', () => { - xit('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; const workerId = hankPymId; @@ -585,7 +595,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { expect(error.message).toBe(`Descanso semanal 36h. / 72h.`); }); - xit('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; const workerId = hankPymId; @@ -618,7 +629,8 @@ describe('workerTimeControl add/delete timeEntry()', () => { }); describe('for 72h weekly rest', () => { - xit('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; const workerId = hankPymId; From 674fe4905825bad12a26e85cb44bda398feb2b24 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 3 Jan 2023 08:41:58 +0100 Subject: [PATCH 03/12] fix(icons): prevent icon translation when using google translator Refs: 5044 --- front/core/components/icon/icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/core/components/icon/icon.js b/front/core/components/icon/icon.js index 38aea0056..8fb79d294 100644 --- a/front/core/components/icon/icon.js +++ b/front/core/components/icon/icon.js @@ -26,7 +26,7 @@ class Icon { Icon.$inject = ['$attrs']; ngModule.vnComponent('vnIcon', { - template: '{{::$ctrl.iconContent}}', + template: '{{::$ctrl.iconContent}}', controller: Icon, bindings: { icon: '@' From d1150d0965b81277339c6fefda389c447dae366e Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 3 Jan 2023 09:01:06 +0100 Subject: [PATCH 04/12] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bafedc760..d7073dc53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +### Fixed +- [General] Al utilizar el traductor de Google se descuadraban los iconos ### Removed - [Tickets](Control clientes) Eliminada sección From cef0152ef5fc35eb6d9fc167e67b0fda047d6102 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 3 Jan 2023 09:44:27 +0100 Subject: [PATCH 05/12] refs #5052 fixing jenkins test --- back/methods/campaign/latest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/campaign/latest.js b/back/methods/campaign/latest.js index 20dda8a26..8817be385 100644 --- a/back/methods/campaign/latest.js +++ b/back/methods/campaign/latest.js @@ -25,7 +25,7 @@ module.exports = Self => { const minDate = new Date(); minDate.setFullYear(minDate.getFullYear() - 1); - const where = {dated: {gte: minDate}}; + const where = {dated: {gte: new Date(minDate)}}; filter = mergeFilters(filter, {where}); const stmt = new ParameterizedSQL( From 17a7bfbf3b1fbb86d16e10c8519ebcaa32df8a97 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 3 Jan 2023 10:11:52 +0100 Subject: [PATCH 06/12] refs #5051 continue fixing test jenkins --- back/methods/campaign/latest.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/back/methods/campaign/latest.js b/back/methods/campaign/latest.js index 8817be385..0cfd541fe 100644 --- a/back/methods/campaign/latest.js +++ b/back/methods/campaign/latest.js @@ -25,13 +25,14 @@ module.exports = Self => { const minDate = new Date(); minDate.setFullYear(minDate.getFullYear() - 1); - const where = {dated: {gte: new Date(minDate)}}; + const where = {dated: {gte: minDate}}; filter = mergeFilters(filter, {where}); const stmt = new ParameterizedSQL( `SELECT * FROM campaign`); stmt.merge(conn.makeWhere(filter.where)); stmt.merge('GROUP BY code'); + stmt.merge('ORDER BY dated ASC'); stmt.merge(conn.makePagination(filter)); return conn.executeStmt(stmt); From 0ae76746ae3204993bc4d822e891ce605edd323c Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 3 Jan 2023 10:20:44 +0100 Subject: [PATCH 07/12] refs #5051 limit stmt --- back/methods/campaign/latest.js | 1 + 1 file changed, 1 insertion(+) diff --git a/back/methods/campaign/latest.js b/back/methods/campaign/latest.js index 0cfd541fe..a05a18eca 100644 --- a/back/methods/campaign/latest.js +++ b/back/methods/campaign/latest.js @@ -33,6 +33,7 @@ module.exports = Self => { stmt.merge(conn.makeWhere(filter.where)); stmt.merge('GROUP BY code'); stmt.merge('ORDER BY dated ASC'); + stmt.merge('LIMIT 10000000000000000000'); stmt.merge(conn.makePagination(filter)); return conn.executeStmt(stmt); From 04d3d13e822acc7fb88f44bd59bf113008d578a7 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 3 Jan 2023 10:36:31 +0100 Subject: [PATCH 08/12] refs #5051 sub stmt --- back/methods/campaign/latest.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/back/methods/campaign/latest.js b/back/methods/campaign/latest.js index a05a18eca..7a4778033 100644 --- a/back/methods/campaign/latest.js +++ b/back/methods/campaign/latest.js @@ -29,10 +29,11 @@ module.exports = Self => { filter = mergeFilters(filter, {where}); const stmt = new ParameterizedSQL( - `SELECT * FROM campaign`); + `SELECT * FROM (`); + stmt.merge('SELECT * FROM campaign'); stmt.merge(conn.makeWhere(filter.where)); + stmt.merge('ORDER BY dated ASC) sub'); stmt.merge('GROUP BY code'); - stmt.merge('ORDER BY dated ASC'); stmt.merge('LIMIT 10000000000000000000'); stmt.merge(conn.makePagination(filter)); From 5c2e85d49970f85acfb39f42d77807d0ef0076ad Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 3 Jan 2023 11:00:01 +0100 Subject: [PATCH 09/12] refs #5051 consolelog date --- back/methods/campaign/latest.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/back/methods/campaign/latest.js b/back/methods/campaign/latest.js index 7a4778033..4ecc92a1c 100644 --- a/back/methods/campaign/latest.js +++ b/back/methods/campaign/latest.js @@ -32,11 +32,13 @@ module.exports = Self => { `SELECT * FROM (`); stmt.merge('SELECT * FROM campaign'); stmt.merge(conn.makeWhere(filter.where)); - stmt.merge('ORDER BY dated ASC) sub'); + stmt.merge('ORDER BY dated ASC'); + stmt.merge(') sub'); stmt.merge('GROUP BY code'); stmt.merge('LIMIT 10000000000000000000'); stmt.merge(conn.makePagination(filter)); - + console.log(stmt); + console.log(minDate); return conn.executeStmt(stmt); }; }; From b5ef0900807d221b5aa0b0d81425dab49053f23e Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 3 Jan 2023 11:39:50 +0100 Subject: [PATCH 10/12] refs #5051 json date --- back/methods/campaign/latest.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/back/methods/campaign/latest.js b/back/methods/campaign/latest.js index 4ecc92a1c..9e472103c 100644 --- a/back/methods/campaign/latest.js +++ b/back/methods/campaign/latest.js @@ -25,7 +25,7 @@ module.exports = Self => { const minDate = new Date(); minDate.setFullYear(minDate.getFullYear() - 1); - const where = {dated: {gte: minDate}}; + const where = {dated: {gte: minDate.toJSON().split('T')[0]}}; filter = mergeFilters(filter, {where}); const stmt = new ParameterizedSQL( @@ -37,8 +37,7 @@ module.exports = Self => { stmt.merge('GROUP BY code'); stmt.merge('LIMIT 10000000000000000000'); stmt.merge(conn.makePagination(filter)); - console.log(stmt); - console.log(minDate); + return conn.executeStmt(stmt); }; }; From c6083ebe61fc0310918188ee0b365ec328d3afa6 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 3 Jan 2023 11:53:47 +0100 Subject: [PATCH 11/12] refs #5051 fdescribe --- back/methods/campaign/latest.js | 2 +- back/methods/campaign/spec/latest.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/back/methods/campaign/latest.js b/back/methods/campaign/latest.js index 9e472103c..6c97d3ce2 100644 --- a/back/methods/campaign/latest.js +++ b/back/methods/campaign/latest.js @@ -33,9 +33,9 @@ module.exports = Self => { stmt.merge('SELECT * FROM campaign'); 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('LIMIT 10000000000000000000'); stmt.merge(conn.makePagination(filter)); return conn.executeStmt(stmt); diff --git a/back/methods/campaign/spec/latest.spec.js b/back/methods/campaign/spec/latest.spec.js index a71849b59..74d384532 100644 --- a/back/methods/campaign/spec/latest.spec.js +++ b/back/methods/campaign/spec/latest.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -describe('campaign latest()', () => { +fdescribe('campaign latest()', () => { it('should return the campaigns from the last year', async() => { const now = new Date(); const result = await app.models.Campaign.latest(); From 6185b2f0558633c9d1d3287737e492cc47164bfe Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 3 Jan 2023 12:04:38 +0100 Subject: [PATCH 12/12] refs #5051 changed fixture --- back/methods/campaign/latest.js | 2 +- back/methods/campaign/spec/latest.spec.js | 2 +- db/dump/fixtures.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/back/methods/campaign/latest.js b/back/methods/campaign/latest.js index 6c97d3ce2..a418f1267 100644 --- a/back/methods/campaign/latest.js +++ b/back/methods/campaign/latest.js @@ -25,7 +25,7 @@ module.exports = Self => { const minDate = new Date(); minDate.setFullYear(minDate.getFullYear() - 1); - const where = {dated: {gte: minDate.toJSON().split('T')[0]}}; + const where = {dated: {gte: minDate}}; filter = mergeFilters(filter, {where}); const stmt = new ParameterizedSQL( diff --git a/back/methods/campaign/spec/latest.spec.js b/back/methods/campaign/spec/latest.spec.js index 74d384532..a71849b59 100644 --- a/back/methods/campaign/spec/latest.spec.js +++ b/back/methods/campaign/spec/latest.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -fdescribe('campaign latest()', () => { +describe('campaign latest()', () => { it('should return the campaigns from the last year', async() => { const now = new Date(); const result = await app.models.Campaign.latest(); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 45fff9169..1ea4fa114 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2652,7 +2652,7 @@ INSERT INTO `vn`.`mdbVersion` (`app`, `branchFk`, `version`) INSERT INTO `vn`.`accountingConfig` (`id`, `minDate`, `maxDate`) VALUES - (1, '2022-01-01', '2024-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`)