merge conflicts structure.sql
gitea/salix/1707route.ticket This commit looks good Details

This commit is contained in:
Bernat Exposito Domenech 2019-12-13 09:06:39 +01:00
commit ff117c1811
25 changed files with 2239 additions and 4706 deletions

View File

@ -1,4 +1,4 @@
FROM mysql:5.6.42
FROM mysql:8.0.18
ENV MYSQL_ROOT_PASSWORD root
ENV TZ Europe/Madrid
@ -7,36 +7,33 @@ ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates \
&& curl -sL https://apt.verdnatura.es/conf/verdnatura.gpg | apt-key add - \
&& echo "deb http://apt.verdnatura.es/ jessie main" > /etc/apt/sources.list.d/vn.list \
&& echo "deb http://apt.verdnatura.es/ stretch main" > /etc/apt/sources.list.d/vn.list \
&& apt-get update \
&& apt-get install -y --allow-unauthenticated vn-mysql \
&& apt-get install -y vn-mysql libmysqlclient21 \
&& apt-get purge -y --auto-remove curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# XXX: Removes the last script line to avoid daemon to be started
RUN cp /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-init.sh \
&& sed -i '$ d' /usr/local/bin/docker-init.sh
WORKDIR /docker-entrypoint-initdb.d
ARG STAMP=unknown
COPY import-changes.sh config.ini /docker-entrypoint-initdb.d/import/
COPY docker.cnf /etc/mysql/mysql.conf.d/
COPY changes /docker-entrypoint-initdb.d/import/changes
COPY docker-boot.sh /docker-entrypoint-initdb.d/
COPY dump /docker-entrypoint-initdb.d/dump
COPY docker/docker.cnf /etc/mysql/conf.d/
COPY docker/docker-init.sh docker/docker-start.sh /usr/local/bin/
RUN mkdir /mysql-data \
&& /usr/local/bin/docker-init.sh mysqld --datadir /mysql-data \
&& chown -R mysql:mysql /mysql-data \
&& chown -R mysql:mysql /mysql-data
WORKDIR /docker-entrypoint-initdb.d
COPY dump dump
COPY docker/docker-boot.sh /docker-entrypoint-initdb.d/
COPY changes import/changes
COPY import-changes.sh config.ini import/
ARG STAMP=unknown
RUN gosu mysql docker-init.sh mysqld \
&& rm -rf /docker-entrypoint-initdb.d/*
COPY docker-start.sh /usr/local/bin/
USER mysql
ENTRYPOINT ["docker-start.sh"]
USER mysql
CMD ["mysqld", "--datadir", "/mysql-data"]
CMD ["mysqld"]
#HEALTHCHECK --interval=5s --timeout=10s --retries=200 \
# CMD mysqladmin ping -h 127.0.0.1 -u root || exit 1

View File

@ -6,8 +6,8 @@ USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT)
BEGIN
/**
* Devuelve el listado de agencias disponibles para la fecha,
* dirección y warehouse pasadas
* Devuelve el listado de agencias disponibles para la fecha,
* dirección y almacén pasados.
*
* @param vAddress
* @param vWarehouse warehouse
@ -30,7 +30,8 @@ BEGIN
JOIN agencyMode am ON am.id = z.agencyModeFk
JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk
WHERE zw.warehouseFk
GROUP BY z.agencyModeFk;
GROUP BY z.agencyModeFk
ORDER BY agencyMode;
DROP TEMPORARY TABLE
tmp.zone,

View File

@ -36,7 +36,7 @@ BEGIN
CALL vn.zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk);
SELECT id INTO vZoneFk FROM tmp.zoneGetShipped
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetShipped
WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1;
INSERT INTO vn2008.Tickets (

View File

@ -1,9 +1,8 @@
USE `hedera`;
DROP procedure IF EXISTS `tpvTransaction_undo`;
DROP procedure IF EXISTS `hedera`.`tpvTransaction_undo`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `tpvTransaction_undo`(vSelf INT)
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`tpvTransaction_undo`(vSelf INT)
BEGIN
DECLARE vCustomer INT;
DECLARE vAmount DOUBLE;

View File

@ -1,4 +0,0 @@
[mysqld]
innodb_log_file_size = 4M
innodb_autoextend_increment = 4
innodb_page_size = 8K

17
db/docker/docker-init.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
. /usr/local/bin/docker-entrypoint.sh
mysql_check_config "$@"
docker_setup_env "$@"
docker_create_db_directories
docker_verify_minimum_env
docker_init_database_dir "$@"
docker_temp_server_start "$@"
docker_setup_db
docker_process_init_files /docker-entrypoint-initdb.d/*
mysql_expire_root_user
docker_temp_server_stop

10
db/docker/docker.cnf Normal file
View File

@ -0,0 +1,10 @@
[mysqld]
innodb_log_file_size = 4M
innodb_autoextend_increment = 4
innodb_page_size = 8K
innodb_default_row_format = COMPACT
log_bin_trust_function_creators = ON
datadir = /mysql-data
sql_mode = NO_ENGINE_SUBSTITUTION
innodb_temp_data_file_path = /tmp/ibtmp1:12M:autoextend
skip-log-bin

View File

@ -1,10 +1,13 @@
-- FIXME: cuando se eliminen los procedimientos de la cache, se podra eliminar esta linea
CREATE SCHEMA IF NOT EXISTS `vn2008`;
CREATE SCHEMA IF NOT EXISTS `tmp`;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1;
ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1;
ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1;
ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1;
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
VALUES
@ -18,7 +21,6 @@ INSERT INTO `vn`.`bionicConfig` (`generalInflationCoeficient`, `minimumDensityVo
VALUES
(1.30, 167.00, 138000, 71);
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`)
SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'es'
FROM `account`.`role` WHERE id <> 20;
@ -1503,13 +1505,13 @@ INSERT INTO `vn`.`ticketServiceType`(`id`, `name`)
(4, 'Cargo FITOSANITARIO'),
(5, 'Documentos');
INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`)
INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`, `ticketServiceTypeFk`)
VALUES
(1, 'Documentos', 1, 2.00, 1, 1),
(2, 'Porte Agencia', 1, 10.00, 1, 2),
(3, 'Documentos', 1, 5.50, 1, 11),
(4, 'Documentos', 1, 2.00, 1, 9),
(5, 'Documentos', 1, 2.00, 1, 8);
(1, 'Documentos', 1, 2.00, 1, 1, 1),
(2, 'Porte Agencia', 1, 10.00, 1, 2, 1),
(3, 'Documentos', 1, 5.50, 1, 11, 1),
(4, 'Documentos', 1, 2.00, 1, 9, 1),
(5, 'Documentos', 1, 2.00, 1, 8, 1);
INSERT INTO `pbx`.`sip`(`user_id`, `extension`)
VALUES
@ -1584,9 +1586,9 @@ INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`
(107, 1, DATE_ADD(CURDATE(), INTERVAL -12 DAY)),
(107, 2, DATE_ADD(CURDATE(), INTERVAL -20 DAY));
INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `user`, `password`, `title`)
INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`)
VALUES
('1', 'https://websms.xtratelecom.es/api_php/server.wsdl', 'VERDINATURA', '182wbOKu', 'Verdnatura');
('1', 'https://websms.xtratelecom.es/api_php/server.wsdl', 'Verdnatura');
INSERT INTO `vn`.`sharingClient`(`id`, `workerFk`, `started`, `ended`, `clientFk`)
VALUES

View File

@ -1,4 +1,4 @@
-- Import compiled functions
CREATE AGGREGATE FUNCTION minacum RETURNS INT SONAME 'minacum.so';
CREATE AGGREGATE FUNCTION multimax RETURNS INT SONAME 'multimax.so';
CREATE AGGREGATE FUNCTION multimax RETURNS INT SONAME 'multimax.so';

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,83 @@ SCHEMAS=(
vncontrol
)
IGNORETABLES=(
--ignore-table=bi.last_Id_Cubo
--ignore-table=bi.v_clientes_jerarquia
--ignore-table=bi.v_ventas_contables
--ignore-table=bs.horasSilla
--ignore-table=bs.productionIndicators
--ignore-table=bs.VentasPorCliente
--ignore-table=bs.v_ventas
--ignore-table=edi.supplyOffer
--ignore-table=postgresql.currentWorkersStats
--ignore-table=vn.accounting__
--ignore-table=vn.agencyModeZone
--ignore-table=vn.agencyProvince
--ignore-table=vn.agencyWarehouse
--ignore-table=vn.awb
--ignore-table=vn.botanicExport__
--ignore-table=vn.clientDefaultCompany
--ignore-table=vn.color
--ignore-table=vn.comparative
--ignore-table=vn.comparativeFilter
--ignore-table=vn.coolerPath
--ignore-table=vn.coolerPathDetail
--ignore-table=vn.department__
--ignore-table=vn.doc
--ignore-table=vn.entity
--ignore-table=vn.especialPrice
--ignore-table=vn.exchangeInsurance
--ignore-table=vn.exchangeInsuranceInPrevious
--ignore-table=vn.exchangeReportSource
--ignore-table=vn.grant
--ignore-table=vn.grantGroup
--ignore-table=vn.invoiceCorrection__
--ignore-table=vn.invoiceIn
--ignore-table=vn.invoiceInAwb
--ignore-table=vn.invoiceInDueDay
--ignore-table=vn.invoiceInEntry
--ignore-table=vn.invoiceInIntrastat
--ignore-table=vn.invoiceInTax
--ignore-table=vn.itemTaxCountrySpain
--ignore-table=vn.mail__
--ignore-table=vn.manaSpellers
--ignore-table=vn.outgoingInvoiceKk
--ignore-table=vn.payment
--ignore-table=vn.paymentExchangeInsurance
--ignore-table=vn.payrollCenter
--ignore-table=vn.plantpassport
--ignore-table=vn.plantpassportAuthority
--ignore-table=vn.preparationException
--ignore-table=vn.priceFixed__
--ignore-table=vn.printer
--ignore-table=vn.printingQueue
--ignore-table=vn.printServerQueue__
--ignore-table=vn.promissoryNote
--ignore-table=vn.rate
--ignore-table=vn.referenceRate__
--ignore-table=vn.routesControl
--ignore-table=vn.salesToPrePrepare
--ignore-table=vn.specialPrice__
--ignore-table=vn.ticketDownBuffer
--ignore-table=vn.ticketeToPreparePrepared
--ignore-table=vn.ticketObservation__
--ignore-table=vn.ticketRequest__
--ignore-table=vn.ticketToPrepare
--ignore-table=vn.till__
--ignore-table=vn.time
--ignore-table=vn.travelThermograph__
--ignore-table=vn.travel_cloneWeekly
--ignore-table=vn.unary
--ignore-table=vn.unaryScan
--ignore-table=vn.unaryScanLine
--ignore-table=vn.unaryScanLineBuy
--ignore-table=vn.unaryScanLineExpedition
--ignore-table=vn.warehouseAlias__
--ignore-table=vn.warehouseJoined
--ignore-table=vn.workerTeam__
--ignore-table=vn.XDiario__
)
mysqldump \
--defaults-file=config.production.ini \
--default-character-set=utf8 \
@ -25,4 +102,5 @@ mysqldump \
--triggers --routines --events \
--databases \
${SCHEMAS[@]} \
${IGNORETABLES[@]} \
> dump/structure.sql

View File

@ -19,4 +19,4 @@ services:
volumes:
- /containers/salix:/etc/salix
- /mnt/storage/pdfs:/var/lib/salix/pdfs
- /mnt/storage/dms:/var/lib/salix/dms
- /mnt/storage/dms:/var/lib/salix/dms

View File

@ -94,38 +94,4 @@ describe('Claim development', () => {
expect(worker).toEqual('deliveryNick');
expect(redelivery).toEqual('Reparto');
});
it('should delete the first development, add an empty one and save it', async() => {
const result = await nightmare
.waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton)
.waitToClick(selectors.claimDevelopment.addDevelopmentButton)
.waitToClick(selectors.claimDevelopment.saveDevelopmentButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the second development was auto filled', async() => {
const reason = await nightmare
.reloadSection('claim.card.development')
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimReasonAutocomplete} input`, 'value');
const result = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResultAutocomplete} input`, 'value');
const responsible = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResponsibleAutocomplete} input`, 'value');
const worker = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimWorkerAutocomplete} input`, 'value');
const redelivery = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimRedeliveryAutocomplete} input`, 'value');
expect(reason).toEqual('Prisas');
expect(result).toEqual('Otros daños');
expect(responsible).toEqual('Compradores');
expect(worker).toEqual('managerNick');
expect(redelivery).toEqual('Cliente');
});
});

View File

@ -1,3 +1,5 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
/**
* Returns a set of allowed values defined on table scheme
@ -7,7 +9,6 @@ module.exports = Self => {
Self.getSetValues = async function(column) {
let model = this.app.models[this.modelName].definition;
let properties = model.properties;
let columnName;
let tableName = this.modelName;
let schema = null;
@ -17,35 +18,32 @@ module.exports = Self => {
schema = tableSplit.pop() || null;
}
if (properties[column]) {
columnName = column;
let property = properties[column];
if (properties[column].mysql)
columnName = properties[column].mysql.columnName;
}
if (!property)
throw new UserError(`Column does not exist`);
let findColumn = Object.keys(properties).find(prop => {
return properties[prop].mysql && properties[prop].mysql.columnName === column;
});
let columnName = property.mysql
? property.mysql.columnName
: column;
if (findColumn)
columnName = properties[findColumn].mysql.columnName;
let type = await this.rawSql(
`SELECT DISTINCT column_type FROM information_schema.columns
let columnInfo = await this.rawSql(
`SELECT column_type columnType
FROM information_schema.columns
WHERE table_name = ?
AND table_schema = IFNULL(?, DATABASE())
AND column_name = ?`,
[tableName, schema, columnName]
);
if (!type) return;
if (!columnInfo || !columnInfo[0])
throw new UserError(`Cannot fetch column values`);
let setValues;
setValues = type[0].column_type;
setValues = setValues.replace(/set\((.*)\)/i, '$1');
setValues = setValues.replace(/'/g, '');
setValues = setValues.match(new RegExp(/(\w+)+/, 'ig'));
setValues = columnInfo[0].columnType
.replace(/^set\((.*)\)$/i, '$1')
.replace(/'/g, '')
.match(new RegExp(/(\w+)+/, 'ig'));
let values = [];
setValues.forEach(setValue => {

View File

@ -13,11 +13,4 @@ describe('Model getSetValues()', () => {
expect(result.length).toEqual(6);
expect(result[5].value).toEqual('TABLET_VN');
});
it('should return an array of set values from table column source_app', async() => {
let result = await app.models.Order.getSetValues('source_app');
expect(result.length).toEqual(6);
expect(result[5].value).toEqual('TABLET_VN');
});
});

View File

@ -117,5 +117,6 @@
"You should specify a date": "Debes especificar una fecha",
"You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fín",
"Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fín",
"You should mark at least one week day": "Debes marcar al menos un día de la semana"
"You should mark at least one week day": "Debes marcar al menos un día de la semana",
"Swift / BIC can't be empty": "Swift / BIC no puede estar vacío"
}

View File

@ -104,9 +104,6 @@ module.exports = Self => {
}
}
},
{
relation: 'claimDestination'
},
{
relation: 'claimReason'
},

View File

@ -18,9 +18,6 @@
"claimResponsibleFk": {
"required": true
},
"workerFk": {
"required": true
},
"claimReasonFk": {
"required": true
},
@ -29,9 +26,6 @@
},
"claimRedeliveryFk": {
"required": true
},
"claimDestinationFk": {
"required": true
}
},
"relations": {
@ -64,11 +58,6 @@
"type": "belongsTo",
"model": "ClaimRedelivery",
"foreignKey": "claimRedeliveryFk"
},
"claimDestination": {
"type": "belongsTo",
"model": "ClaimDestination",
"foreignKey": "claimDestinationFk"
}
}
}

View File

@ -47,17 +47,25 @@ module.exports = Self => {
let xmlParsed;
let status;
try {
[xmlResponse] = await soapClient.sendSMSAsync(params);
xmlResult = xmlResponse.result.$value;
xmlParsed = await new Promise((resolve, reject) => {
xmlParser(xmlResult, (err, result) => {
if (err)
reject(err);
resolve(result);
if (process.env.NODE_ENV !== 'production') {
status = {
codigo: [200],
descripcion: ['Fake response']
};
} else {
[xmlResponse] = await soapClient.sendSMSAsync(params);
xmlResult = xmlResponse.result.$value;
xmlParsed = await new Promise((resolve, reject) => {
xmlParser(xmlResult, (err, result) => {
if (err)
reject(err);
resolve(result);
});
});
});
[status] = xmlParsed['xtratelecom-sms-response'].sms;
[status] = xmlParsed['xtratelecom-sms-response'].sms;
}
} catch (e) {
console.error(e);
}

View File

@ -32,43 +32,6 @@ describe('sms send()', () => {
let result = await app.models.Sms.send(ctx, 105, 'destination', 'My SMS Body');
expect(result.statusCode).toEqual(200);
expect(result.status).toContain('Envio en procesamiento');
});
it(`should throw if the response code isn't 200`, async() => {
let error;
const code = 400;
const smsConfig = await app.models.SmsConfig.findOne();
const soapClient = await soap.createClientAsync(smsConfig.uri);
spyOn(soap, 'createClientAsync').and.returnValue(soapClient);
spyOn(soapClient, 'sendSMSAsync').and.returnValue([{
result: {
$value:
`<xtratelecom-sms-response>
<sms>
<codigo>
${code}
</codigo>
<descripcion>
Envio en procesamiento
</descripcion>
<messageId>
1
</messageId>
</sms>
<procesoId>
444328681
</procesoId>
</xtratelecom-sms-response>`
}
}]);
let ctx = {req: {accessToken: {userId: 1}}};
try {
await app.models.Sms.send(ctx, 105, 'destination', 'My SMS Body');
} catch (err) {
error = err;
}
expect(error.message).toEqual(`We weren't able to send this SMS`);
expect(result.status).toContain('Fake response');
});
});

View File

@ -115,7 +115,7 @@
</vn-td>
<vn-td number>{{::sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{::sale.discount}} %</vn-td>
<vn-td number>{{::sale.quantity * sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{::sale.quantity * sale.price * ((100 - sale.discount) / 100) | currency: 'EUR':2}}</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
@ -139,25 +139,27 @@
</vn-tbody>
</vn-table>
</vn-one>
<vn-one ng-if="$ctrl.summary.services.length != 0">
<vn-one class="services" ng-if="$ctrl.summary.services.length != 0">
<h4 translate>Service</h4>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th number>Id</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Price</vn-th>
<vn-th>Tax class</vn-th>
<vn-th shrink></vn-th>
<vn-th class="identifier" number shrink>Id</vn-th>
<vn-th number shrink>Quantity</vn-th>
<vn-th expand>Description</vn-th>
<vn-th number shrink>Price</vn-th>
<vn-th class="tax-class">Tax class</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="service in $ctrl.summary.services">
<vn-td number>{{::service.id}}</vn-td>
<vn-td number>{{::service.quantity}}</vn-td>
<vn-td></vn-td>
<vn-td class="identifier" number shrink>{{::service.id}}</vn-td>
<vn-td number shrink>{{::service.quantity}}</vn-td>
<vn-td expand>{{::service.description}}</vn-td>
<vn-td number>{{::service.price}}</vn-td>
<vn-td>{{::service.taxClass.description}}</vn-td>
<vn-td number shrink>{{::service.price}}</vn-td>
<vn-td class="tax-class">{{::service.taxClass.description}}</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>

View File

@ -31,7 +31,7 @@ vn-ticket-summary .summary {
}
}
& > div > vn-horizontal > vn-one {
& > vn-horizontal > vn-one {
min-width: 10em;
&.taxes {
@ -44,5 +44,23 @@ vn-ticket-summary .summary {
margin: .2em;
}
}
&.services {
.vn-table > vn-thead .identifier,
.vn-table > vn-tbody .identifier {
min-width: 3.5em
}
.vn-table > vn-thead .tax-class,
.vn-table > vn-tbody .tax-class {
min-width: 11em;
width: 1px
}
.vn-table > vn-tbody vn-td:first-child {
min-width: 24px;
}
}
}
}

View File

@ -1,6 +1,7 @@
const app = require('vn-loopback/server/server');
describe('Worker absences()', () => {
// #1924 - Fix hours
xdescribe('Worker absences()', () => {
it('should get the absence calendar for a full year contract', async() => {
let ctx = {req: {accessToken: {userId: 106}}};
let workerFk = 106;
@ -34,7 +35,11 @@ describe('Worker absences()', () => {
let workerFk = 106;
let worker = await app.models.WorkerLabour.findById(workerFk);
let endedDate = worker.ended;
await worker.updateAttributes({ended: null});
await app.models.WorkerLabour.rawSql(
`UPDATE postgresql.business SET date_end = ? WHERE business_id = ?`,
[null, worker.businessFk]
);
let ctx = {req: {accessToken: {userId: 9}}};
@ -63,7 +68,10 @@ describe('Worker absences()', () => {
expect(sixthType).toEqual('Holidays');
// restores the contract end date
await worker.updateAttributes({ended: endedDate});
await app.models.WorkerLabour.rawSql(
`UPDATE postgresql.business SET date_end = ? WHERE business_id = ?`,
[endedDate, worker.businessFk]
);
});
it('should give the same holidays as worked days since the holidays amount matches the amount of days in a year', async() => {
@ -112,7 +120,10 @@ describe('Worker absences()', () => {
startingContract.setMonth(today.getMonth());
startingContract.setDate(1);
await contract.updateAttributes({started: startingContract});
await app.models.WorkerLabour.rawSql(
`UPDATE postgresql.business SET date_start = ? WHERE business_id = ?`,
[startingContract, contract.businessFk]
);
let ctx = {req: {accessToken: {userId: 106}}};
let workerFk = 106;
@ -148,6 +159,10 @@ describe('Worker absences()', () => {
days: originalHolidaysValue
}
);
await contract.updateAttributes({started: contractStartDate});
await app.models.WorkerLabour.rawSql(
`UPDATE postgresql.business SET date_start = ? WHERE business_id = ?`,
[contractStartDate, contract.businessFk]
);
});
});