Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4088-client_web-access_email

This commit is contained in:
Alex Moreno 2022-06-21 13:40:24 +02:00
commit 17fd50ee33
4 changed files with 19 additions and 19 deletions

View File

@ -1892,6 +1892,10 @@ INSERT INTO `postgresql`.`business` (`client_id`, `provider_id`, `date_start`, `
FROM `postgresql`.`profile` `p`
WHERE `p`.`profile_id` = 1109;
UPDATE `postgresql`.`business`
SET `payedHolidays`= 8
WHERE `business_id`= 1106;
INSERT INTO `postgresql`.`business_labour` (`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`)
VALUES
(1111, NULL, 23, 1, 0.0, 1, 1, 1, 1);

View File

@ -19,6 +19,7 @@
disabled="!$ctrl.clientId"
url="{{ $ctrl.clientId ? 'Clients/'+ $ctrl.clientId +'/addresses' : null }}"
fields="['nickname', 'street', 'city']"
where="{isActive: true}"
ng-model="$ctrl.addressId"
show-field="nickname"
value-field="id"

View File

@ -57,25 +57,9 @@ module.exports = Self => {
ended.setDate(0);
ended.setHours(23, 59, 59, 59);
const filter = {
where: {
and: [
{workerFk: id},
{
or: [
{started: {between: [started, ended]}},
{ended: {between: [started, ended]}},
{and: [{started: {lt: started}}, {ended: {gt: ended}}]},
{and: [{started: {lt: started}}, {ended: null}]}
]
}
],
}
};
const contracts = await models.WorkerLabour.find(filter, myOptions);
let [firstContract] = contracts;
const payedHolidays = firstContract.payedHolidays;
const filter = {where: {businessFk: args.businessFk}};
const contract = await models.WorkerLabour.findOne(filter, myOptions);
const payedHolidays = contract.payedHolidays;
let queryIndex;
const year = started.getFullYear();

View File

@ -27,4 +27,15 @@ describe('Worker holidays()', () => {
expect(result.totalHolidays).toEqual(27.5);
expect(result.holidaysEnjoyed).toEqual(5);
});
it('should now get the payed holidays calendar for a worker', async() => {
const now = new Date();
const year = now.getFullYear();
ctx.args = {businessFk: businessId, year: year};
const result = await app.models.Worker.holidays(ctx, workerId);
expect(result.payedHolidays).toEqual(8);
});
});