fix: añadidos await y actualizado condicional permissionRate
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-01-18 13:05:02 +01:00
parent 4b60aacbbe
commit 7368b572a0
2 changed files with 4 additions and 5 deletions

View File

@ -165,9 +165,8 @@ module.exports = Self => {
for (let day of days[index]) {
workerFk = day.workerFk;
console.log(day);
if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null
&& (day.permissionRate ? day.permissionRate : true)) {
&& (day.permissionRate == null ? true : day.permissionRate)) {
if (day.timeTable == null) {
const timed = new Date(day.dated);
await models.WorkerTimeControl.create({
@ -314,7 +313,7 @@ module.exports = Self => {
}, myOptions);
if (firstWorkerTimeControl)
firstWorkerTimeControl.updateAttribute('direction', 'in', myOptions);
await firstWorkerTimeControl.updateAttribute('direction', 'in', myOptions);
const lastWorkerTimeControl = await models.WorkerTimeControl.findOne({
where: {
@ -325,7 +324,7 @@ module.exports = Self => {
}, myOptions);
if (lastWorkerTimeControl)
lastWorkerTimeControl.updateAttribute('direction', 'out', myOptions);
await lastWorkerTimeControl.updateAttribute('direction', 'out', myOptions);
}
}

View File

@ -2,7 +2,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('weeklyHourRecordEmail', {
description: 'Sends the buyer waste email',
description: 'Sends the weekly hour record',
accessType: 'WRITE',
accepts: [
{