From ee704b302ccdb7443890b7099da5b454dd3e6ed8 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Mon, 6 Jul 2020 10:20:45 +0200 Subject: [PATCH] update order filter --- e2e/helpers/selectors.js | 2 +- e2e/paths/07-order/05_index.spec.js | 8 ++++---- .../back/methods/claim/specs/regularizeClaim.spec.js | 3 +-- modules/order/back/methods/order/filter.js | 8 ++++++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index c9286ef43..1f1ce7da5 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -625,7 +625,7 @@ export default { }, ordersIndex: { searchResult: 'vn-order-index vn-card > vn-table > div > vn-tbody > a.vn-tr', - firstSearchResultTotal: 'vn-order-index vn-card > vn-table > div > vn-tbody vn-tr vn-td:nth-child(7)', + secondSearchResultTotal: 'vn-order-index vn-card > vn-table > div > vn-tbody vn-tr:nth-child(2) vn-td:nth-child(9)', searchResultDate: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)', searchResultAddress: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)', searchButton: 'vn-searchbar vn-icon[icon="search"]', diff --git a/e2e/paths/07-order/05_index.spec.js b/e2e/paths/07-order/05_index.spec.js index ef55051aa..c07a9c6f7 100644 --- a/e2e/paths/07-order/05_index.spec.js +++ b/e2e/paths/07-order/05_index.spec.js @@ -15,9 +15,9 @@ describe('Order Index', () => { await browser.close(); }); - it(`should check the first search result doesn't contain a total of 0€`, async() => { + it(`should check the second search result doesn't contain a total of 0€`, async() => { await page.waitToClick(selectors.ordersIndex.searchButton); - const result = await page.waitToGetProperty(selectors.ordersIndex.firstSearchResultTotal, 'innerText'); + const result = await page.waitToGetProperty(selectors.ordersIndex.secondSearchResultTotal, 'innerText'); expect(result).not.toContain('0.00'); }); @@ -26,8 +26,8 @@ describe('Order Index', () => { await page.waitToClick(selectors.ordersIndex.openAdvancedSearch); await page.waitToClick(selectors.ordersIndex.advancedSearchShowEmptyCheckbox); await page.waitToClick(selectors.ordersIndex.advancedSearchButton); - await page.waitForTextInElement(selectors.ordersIndex.firstSearchResultTotal, '0.00'); - const result = await page.waitToGetProperty(selectors.ordersIndex.firstSearchResultTotal, 'innerText'); + await page.waitForTextInElement(selectors.ordersIndex.secondSearchResultTotal, '0.00'); + const result = await page.waitToGetProperty(selectors.ordersIndex.secondSearchResultTotal, 'innerText'); expect(result).toContain('0.00'); }); diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index ecaccd4e4..1d3bff26d 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -1,7 +1,6 @@ const app = require('vn-loopback/server/server'); -// #2304 -xdescribe('regularizeClaim()', () => { +describe('regularizeClaim()', () => { const claimFk = 1; const pendentState = 1; const resolvedState = 3; diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index 7f45904eb..3821c31e4 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -133,7 +133,6 @@ module.exports = Self => { }); filter = mergeFilters(filter, {where}); - let stmts = []; let stmt; @@ -178,7 +177,12 @@ module.exports = Self => { }); } - stmt.merge(conn.makeSuffix(filter)); + // stmt.merge(conn.makeSuffix(filter)); + stmt.merge(conn.makeWhere(filter.where)); + stmt.merge({ + sql: `GROUP BY o.id` + }); + stmt.merge(conn.makePagination(filter)); stmts.push(stmt); stmts.push(`