Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4797-worker-notification-selector

This commit is contained in:
Alexandre Riera 2023-05-15 14:27:49 +02:00
commit d4e2049bc7
19 changed files with 122 additions and 65 deletions

View File

@ -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

View File

@ -34,6 +34,8 @@ async function test() {
app.boot(bootOptions,
err => err ? reject(err) : resolve());
});
// FIXME: Workaround to wait for loopback to be ready
await app.models.Application.status();
const Jasmine = require('jasmine');
const jasmine = new Jasmine();
@ -53,7 +55,7 @@ async function test() {
const JunitReporter = require('jasmine-reporters');
jasmine.addReporter(new JunitReporter.JUnitXmlReporter());
jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
jasmine.exitOnCompletion = true;
}

View File

@ -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`;

View File

@ -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';

View File

@ -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');

View File

@ -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(

View File

@ -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);
});
});

View File

@ -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'
}

View File

@ -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';

View File

@ -28,7 +28,7 @@
<vn-table model="model" auto-load="false">
<vn-thead>
<vn-tr>
<vn-th field="shipped" default-order="DESC" expand>Date</vn-th>
<vn-th field="shipped" expand>Date</vn-th>
<vn-th field="userFk">Created by</vn-thfield></vn-th>
<vn-th field="description">Comment</vn-th>
<vn-th field="greugeTypeFk">Type</vn-th>

View File

@ -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

View File

@ -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

View File

@ -24,7 +24,7 @@
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th shrink field="itemFk" default-order="ASC" number>Item</vn-th>
<vn-th shrink field="itemFk" number>Item</vn-th>
<vn-th>Description</vn-th>
<vn-th shrink field="quantity" number>Quantity</vn-th>
<vn-th shrink number>m³ per quantity</vn-th>

View File

@ -6,9 +6,10 @@ class Controller extends Section {
constructor($element, $) {
super($element, $);
this.filter = {
include: [{
include: {
relation: 'item'
}]
},
order: 'itemFk'
};
this.order = {};
this.ticketVolumes = [];

View File

@ -1,4 +1,5 @@
<vn-crud-model auto-load="false"
<vn-crud-model
auto-load="true"
vn-id="model"
url="sales"
filter="::$ctrl.filter"
@ -23,7 +24,7 @@
<vn-thead>
<vn-tr>
<vn-th field="itemFk" number>Item</vn-th>
<vn-th field="concept" default-order="ASC">Description</vn-th>
<vn-th field="concept">Description</vn-th>
<vn-th field="itemPackingTypeFk" number>Packing type</vn-th>
<vn-th field="quantity" number>Quantity</vn-th>
<vn-th number>m³ per quantity</vn-th>

View File

@ -5,9 +5,10 @@ class Controller extends Section {
constructor($element, $) {
super($element, $);
this.filter = {
include: [{
include: {
relation: 'item'
}]
},
order: 'concept'
};
this.ticketVolumes = [];

View File

@ -1,6 +1,7 @@
subject: Weekly time log
title: Record of hours week {0} year {1}
dear: Dear worker
description: Access the following link:<br/><br/>
{0} <br/><br/>
Acceda al siguiente enlace: Access the following link:<br/>
description:
Click 'SATISFIED' if you agree with the hours worked. Otherwise, press 'NOT SATISFIED', detailing the cause of the disagreement.
Hours: Hours

View File

@ -1,6 +1,7 @@
subject: Registro de horas semanal
title: Registro de horas semana {0} año {1}
dear: Estimado trabajador
description: Acceda al siguiente enlace:<br/><br/>
{0} <br/><br/>
toaccess: Acceda al siguiente enlace:<br/>
description:
Pulse 'CONFORME' si esta de acuerdo con las horas trabajadas. En caso contrario pulse 'NO CONFORME', detallando la causa de la disconformidad.
Hours: Horas

View File

@ -3,7 +3,9 @@
<div class="grid-block vn-pa-ml">
<h1>{{ $t('title', [week, year]) }}</h1>
<p>{{$t('dear')}},</p>
<p v-html="$t('description', [url])"></p>
<p v-html="$t('toaccess')"></p>
<a :href="url"><button>{{$t('Hours')}}</button></a>
<p>{{$t('description')}}</p>
</div>
</div>
</email-body>