diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5ff575175..083e43199 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- (Ticket -> Boxing) Arreglado selección de horas
+- (Cesta -> Índice) Optimizada búsqueda
diff --git a/db/changes/231801/00-optimiceZoneEstimatedDelivery.sql b/db/changes/231801/00-optimiceZoneEstimatedDelivery.sql
new file mode 100644
index 000000000..209e1efc3
--- /dev/null
+++ b/db/changes/231801/00-optimiceZoneEstimatedDelivery.sql
@@ -0,0 +1,77 @@
+CREATE OR REPLACE
+ALGORITHM = UNDEFINED VIEW `vn`.`zoneEstimatedDelivery` AS
+select
+ `t`.`zoneFk` AS `zoneFk`,
+ cast(`util`.`VN_CURDATE`() + interval hour(ifnull(`zc`.`hour`, `z`.`hour`)) * 60 + minute(ifnull(`zc`.`hour`, `z`.`hour`)) minute as time) AS `hourTheoretical`,
+ cast(sum(`sv`.`volume`) as decimal(5, 1)) AS `totalVolume`,
+ cast(sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) as decimal(5, 1)) AS `remainingVolume`,
+ greatest(
+ ifnull(`lhp`.`m3`, 0),
+ ifnull(`dl`.`minSpeed`, 0)
+ ) AS `speed`,
+ cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0)) minute as time) AS `hourEffective`,
+ floor(-sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0))) AS `minutesLess`,
+ cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0)) minute as time) AS `etc`
+from
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ `vn`.`ticket` `t`
+ join `vn`.`ticketStateToday` `tst` on
+ (
+ `tst`.`ticket` = `t`.`id`
+ )
+ )
+ join `vn`.`state` `s` on
+ (
+ `s`.`id` = `tst`.`state`
+ )
+ )
+ join `vn`.`saleVolume` `sv` on
+ (
+ `sv`.`ticketFk` = `t`.`id`
+ )
+ )
+ left join `vn`.`lastHourProduction` `lhp` on
+ (
+ `lhp`.`warehouseFk` = `t`.`warehouseFk`
+ )
+ )
+ join `vn`.`warehouse` `w` on
+ (
+ `w`.`id` = `t`.`warehouseFk`
+ )
+ )
+ join `vn`.`warehouseAlias` `wa` on
+ (
+ `wa`.`id` = `w`.`aliasFk`
+ )
+ )
+ straight_join `vn`.`zone` `z` on
+ (
+ `z`.`id` = `t`.`zoneFk`
+ )
+ )
+ left join `vn`.`zoneClosure` `zc` on
+ (
+ `zc`.`zoneFk` = `t`.`zoneFk`
+ and `zc`.`dated` = `util`.`VN_CURDATE`()
+ )
+ )
+ left join `cache`.`departure_limit` `dl` on
+ (
+ `dl`.`warehouse_id` = `t`.`warehouseFk`
+ and `dl`.`fecha` = `util`.`VN_CURDATE`()
+ )
+ )
+where
+ `w`.`hasProduction` <> 0
+ and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`()
+group by
+ `t`.`zoneFk`;
diff --git a/db/changes/230801/00-ticketConfig.sql b/db/changes/231801/00-ticketConfig.sql
similarity index 79%
rename from db/changes/230801/00-ticketConfig.sql
rename to db/changes/231801/00-ticketConfig.sql
index ca63dbf63..7c8aa83a4 100644
--- a/db/changes/230801/00-ticketConfig.sql
+++ b/db/changes/231801/00-ticketConfig.sql
@@ -1 +1 @@
-ALTER TABLE `vn`.`ticketConfig` ADD daysForWarningClaim INT DEFAULT 2 NOT NULL COMMENT 'dias restantes hasta que salte el aviso de reclamación fuerade plazo';
+ALTER TABLE `vn`.`ticketConfig` ADD daysForWarningClaim INT DEFAULT 2 NOT NULL COMMENT 'dias restantes hasta que salte el aviso de reclamación fuera de plazo';
diff --git a/e2e/paths/02-client/10_add_greuge.spec.js b/e2e/paths/02-client/10_add_greuge.spec.js
index 6ea923a28..9141c499a 100644
--- a/e2e/paths/02-client/10_add_greuge.spec.js
+++ b/e2e/paths/02-client/10_add_greuge.spec.js
@@ -29,19 +29,16 @@ describe('Client Add greuge path', () => {
expect(message.text).toContain('Some fields are invalid');
});
- it(`should create a new greuge with all its data`, async() => {
+ it(`should create a new greuge with all its data and confirm the greuge was added to the list`, async() => {
await page.write(selectors.clientGreuge.amount, '999');
await page.waitForTextInField(selectors.clientGreuge.amount, '999');
await page.write(selectors.clientGreuge.description, 'new armor for Batman!');
await page.waitToClick(selectors.clientGreuge.saveButton);
const message = await page.waitForSnackbar();
- expect(message.text).toContain('Data saved!');
- });
-
- it('should confirm the greuge was added to the list', async() => {
const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
+ expect(message.text).toContain('Data saved!');
expect(result).toContain(999);
expect(result).toContain('new armor for Batman!');
expect(result).toContain('Diff');
diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js
index 421a79f9b..495a7d2b0 100644
--- a/front/core/components/crud-model/crud-model.js
+++ b/front/core/components/crud-model/crud-model.js
@@ -139,7 +139,7 @@ export default class CrudModel extends ModelProxy {
filter.limit = this.page * this.limit;
}
- return this.sendRequest(filter, append);
+ return this.sendRequest(filter, append, true);
}
clear() {
@@ -231,12 +231,12 @@ export default class CrudModel extends ModelProxy {
return params;
}
- sendRequest(filter, append) {
+ sendRequest(filter, append, loadMore) {
this.cancelRequest();
this.canceler = this.$q.defer();
this.isPaging = append;
- if (!append && this.status != 'ready')
+ if (!loadMore)
this.status = 'loading';
let params = Object.assign(
diff --git a/front/core/components/crud-model/index.spec.js b/front/core/components/crud-model/index.spec.js
index 7eab80405..e42476098 100644
--- a/front/core/components/crud-model/index.spec.js
+++ b/front/core/components/crud-model/index.spec.js
@@ -150,7 +150,7 @@ describe('Component vnCrudModel', () => {
controller.loadMore(true);
- expect(controller.sendRequest).toHaveBeenCalledWith({'skip': 2}, true);
+ expect(controller.sendRequest).toHaveBeenCalledWith({'skip': 2}, true, true);
});
});
diff --git a/front/core/components/th/index.js b/front/core/components/th/index.js
index 341558fb1..9f1e11903 100644
--- a/front/core/components/th/index.js
+++ b/front/core/components/th/index.js
@@ -8,18 +8,8 @@ export default class Th {
$element.on('click', () => this.onToggleOrder());
}
- /**
- * Changes the order if the cell has a field and defaultOrder property
- */
$onInit() {
if (!this.field) return;
-
- if (this.defaultOrder) {
- this.order = this.defaultOrder;
- this.table.applyOrder(this.field, this.order);
- this.updateArrow();
- }
-
this.updateArrow();
}
@@ -82,9 +72,6 @@ ngModule.vnComponent('vnTh', {
template: require('./index.html'),
transclude: true,
controller: Th,
- bindings: {
- defaultOrder: '@?'
- },
require: {
table: '^^vnTable'
}
diff --git a/front/core/components/th/index.spec.js b/front/core/components/th/index.spec.js
index a00f73cc9..a3bf19898 100644
--- a/front/core/components/th/index.spec.js
+++ b/front/core/components/th/index.spec.js
@@ -17,17 +17,6 @@ describe('Component vnTh', () => {
controller.column.setAttribute('field', 'MyField');
}));
- describe('onInit()', () => {
- it(`should define controllers order as per defaultOrder then call setOrder()`, () => {
- controller.defaultOrder = 'DESC';
- jest.spyOn(controller.table, 'setOrder');
- controller.$onInit();
-
- expect(controller.order).toEqual('DESC');
- expect(controller.table.setOrder).toHaveBeenCalledWith('MyField', 'DESC');
- });
- });
-
describe('toggleOrder()', () => {
it(`should change the ordenation to DESC (descendant) if it was ASC (ascendant)`, () => {
controller.order = 'ASC';
@@ -61,7 +50,7 @@ describe('Component vnTh', () => {
expect(controller.updateArrow).not.toHaveBeenCalledWith();
});
- it(`should call toggleOrder() method if field property and
+ it(`should call toggleOrder() method if field property and
table field property equals and then call updateArrow()`, () => {
controller.table.field = 'MyField';
jest.spyOn(controller, 'toggleOrder');
@@ -73,7 +62,7 @@ describe('Component vnTh', () => {
expect(controller.updateArrow).toHaveBeenCalledWith();
});
- it(`should call setOrder() method if field property and
+ it(`should call setOrder() method if field property and
table field property doesn't equals and then call updateArrow()`, () => {
controller.table.field = 'MyField2';
jest.spyOn(controller.table, 'setOrder');
diff --git a/modules/client/front/greuge/index/index.html b/modules/client/front/greuge/index/index.html
index 459d92fc7..014246b31 100644
--- a/modules/client/front/greuge/index/index.html
+++ b/modules/client/front/greuge/index/index.html
@@ -7,8 +7,8 @@
data="greuges"
auto-load="true">
-
@@ -28,7 +28,7 @@
- Date
+ Date
Created by
Comment
Type
@@ -53,11 +53,11 @@
-
\ No newline at end of file
+
diff --git a/modules/client/front/greuge/index/index.js b/modules/client/front/greuge/index/index.js
index 7a5ccc531..4f1b77b4b 100644
--- a/modules/client/front/greuge/index/index.js
+++ b/modules/client/front/greuge/index/index.js
@@ -11,8 +11,7 @@ class Controller extends Section {
scope: {
fields: ['id', 'name']
},
- },
- {
+ }, {
relation: 'user',
scope: {
fields: ['id', 'name']
@@ -24,8 +23,6 @@ class Controller extends Section {
}
}
-Controller.$inject = ['$element', '$scope'];
-
ngModule.vnComponent('vnClientGreugeIndex', {
template: require('./index.html'),
controller: Controller
diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js
index 008c0e5c9..10185af7e 100644
--- a/modules/order/back/methods/order/filter.js
+++ b/modules/order/back/methods/order/filter.js
@@ -141,7 +141,7 @@ module.exports = Self => {
let stmt;
stmt = new ParameterizedSQL(
- `CREATE TEMPORARY TABLE tmp.filter
+ `CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
ENGINE = MEMORY
SELECT
diff --git a/modules/order/front/volume/index.html b/modules/order/front/volume/index.html
index 7c2ff4e3d..e0053f9ed 100644
--- a/modules/order/front/volume/index.html
+++ b/modules/order/front/volume/index.html
@@ -12,11 +12,11 @@