Merge pull request 'hotfix_sendMail' (!1587) from hotfix_sendMail into master
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #1587
Reviewed-by: Alexandre Riera <alexandre@verdnatura.es>
This commit is contained in:
Vicent Llopis 2023-06-02 10:39:17 +00:00
commit 1408e5f5ad
3 changed files with 19 additions and 19 deletions

View File

@ -230,21 +230,21 @@ module.exports = Self => {
}, myOptions);
} else {
const weekDay = day.dated.getDay();
const journeys = await models.Journey.find({
const journeys = await models.BusinessSchedule.find({
where: {
business_id: day.businessFk,
day_id: weekDay
businessFk: day.businessFk,
weekday: weekDay
}
}, myOptions);
let timeTableDecimalInSeconds = 0;
for (let journey of journeys) {
const start = Date.vnNew();
const [startHours, startMinutes, startSeconds] = getTime(journey.start);
const [startHours, startMinutes, startSeconds] = getTime(journey.started);
start.setHours(startHours, startMinutes, startSeconds, 0);
const end = Date.vnNew();
const [endHours, endMinutes, endSeconds] = getTime(journey.end);
const [endHours, endMinutes, endSeconds] = getTime(journey.ended);
end.setHours(endHours, endMinutes, endSeconds, 0);
const result = (end - start) / 1000;
@ -255,7 +255,7 @@ module.exports = Self => {
const timeTableDecimal = timeTableDecimalInSeconds / 3600;
if (day.timeWorkDecimal == timeTableDecimal) {
const timed = new Date(day.dated);
const [startHours, startMinutes, startSeconds] = getTime(journey.start);
const [startHours, startMinutes, startSeconds] = getTime(journey.started);
await models.WorkerTimeControl.create({
userFk: day.workerFk,
timed: timed.setHours(startHours, startMinutes, startSeconds),
@ -263,7 +263,7 @@ module.exports = Self => {
isSendMail: true
}, myOptions);
const [endHours, endMinutes, endSeconds] = getTime(journey.end);
const [endHours, endMinutes, endSeconds] = getTime(journey.ended);
await models.WorkerTimeControl.create({
userFk: day.workerFk,
timed: timed.setHours(endHours, endMinutes, endSeconds),
@ -276,7 +276,7 @@ module.exports = Self => {
});
if (journey == minStart) {
const timed = new Date(day.dated);
const [startHours, startMinutes, startSeconds] = getTime(journey.start);
const [startHours, startMinutes, startSeconds] = getTime(journey.started);
await models.WorkerTimeControl.create({
userFk: day.workerFk,
timed: timed.setHours(startHours, startMinutes, startSeconds),
@ -304,7 +304,7 @@ module.exports = Self => {
});
if (journey == minStart) {
const timed = new Date(day.dated);
const [startHours, startMinutes, startSeconds] = getTime(journey.start);
const [startHours, startMinutes, startSeconds] = getTime(journey.started);
await models.WorkerTimeControl.create({
userFk: day.workerFk,
timed: timed.setHours(startHours + 1, startMinutes, startSeconds),

View File

@ -2,6 +2,9 @@
"AbsenceType": {
"dataSource": "vn"
},
"BusinessSchedule": {
"dataSource": "vn"
},
"Calendar": {
"dataSource": "vn"
},
@ -38,9 +41,6 @@
"EducationLevel": {
"dataSource": "vn"
},
"Journey": {
"dataSource": "vn"
},
"ProfileType":{
"dataSource": "vn"
},

View File

@ -1,26 +1,26 @@
{
"name": "Journey",
"name": "BusinessSchedule",
"base": "VnModel",
"options": {
"mysql": {
"table": "postgresql.journey"
"table": "businessSchedule"
}
},
"properties": {
"journey_id": {
"id": {
"id": true,
"type": "number"
},
"day_id": {
"weekday": {
"type": "number"
},
"start": {
"started": {
"type": "date"
},
"end": {
"ended": {
"type": "date"
},
"business_id": {
"businessFk": {
"type": "number"
}
}