3928-worker.time-control_sendMail #1129

Merged
joan merged 26 commits from 3928-worker.time-control_sendMail into dev 2022-11-11 07:30:09 +00:00
2 changed files with 4 additions and 26 deletions
Showing only changes of commit 98cc2b5866 - Show all commits

View File

@ -2715,19 +2715,6 @@ UPDATE `account`.`user`
SET `hasGrant` = 1 SET `hasGrant` = 1
WHERE `id` = 66; WHERE `id` = 66;
INSERT INTO `postgresql`.`journey` (`journey_id`, `day_id`, `start`, `end`, `business_id`)
VALUES
(1, 1, '09:00:00', '13:00:00', 18),
(2, 1, '14:00:00', '19:00:00', 18),
(3, 3, '12:30:00', '19:00:00', 18),
(4, 4, '01:30:00', '07:30:00', 18),
(5, 5, '01:00:00', '09:00:00', 18),
(6, 6, '02:00:00', '08:00:00', 18),
(7, 1, '07:00:00', '12:00:00', 19),
(8, 2, '09:00:00', '17:00:00', 19),
(9, 3, '15:00:00', '19:00:00', 19),
(10, 4, '07:00:00', '14:00:00', 19),
(11, 5, '08:00:00', '13:00:00', 19);
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`) INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
VALUES VALUES

View File

@ -72,9 +72,6 @@ module.exports = Self => {
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate'); stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate');
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate'); stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate');
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate1');
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate1');
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.error');
if (args.workerId) { if (args.workerId) {
await models.WorkerTimeControl.destroyAll({ await models.WorkerTimeControl.destroyAll({
@ -122,12 +119,6 @@ module.exports = Self => {
stmts.push(stmt); stmts.push(stmt);
} }
stmts.push(`CREATE TEMPORARY TABLE tmp.timeControlCalculate1
SELECT * FROM tmp.timeControlCalculate`);
stmts.push(`CREATE TEMPORARY TABLE tmp.timeBusinessCalculate1
SELECT * FROM tmp.timeBusinessCalculate`);
stmt = new ParameterizedSQL(` stmt = new ParameterizedSQL(`
SELECT CONCAT(u.name, '@verdnatura.es') receiver, SELECT CONCAT(u.name, '@verdnatura.es') receiver,
u.id workerFk, u.id workerFk,
@ -147,13 +138,12 @@ module.exports = Self => {
JOIN business b ON b.id = tb.businessFk JOIN business b ON b.id = tb.businessFk
LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk AND tc.dated = tb.dated LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk AND tc.dated = tb.dated
LEFT JOIN worker w ON w.id = u.id LEFT JOIN worker w ON w.id = u.id
LEFT JOIN user u2 ON u2.id = w.bossFk
JOIN (SELECT tb.userFk, JOIN (SELECT tb.userFk,
SUM(IF(tb.type IS NULL, SUM(IF(tb.type IS NULL,
IF(tc.timeWorkDecimal > 0, FALSE, IF(tb.timeWorkDecimal > 0, TRUE, FALSE)), IF(tc.timeWorkDecimal > 0, FALSE, IF(tb.timeWorkDecimal > 0, TRUE, FALSE)),
TRUE))isTeleworkingWeek TRUE))isTeleworkingWeek
FROM tmp.timeBusinessCalculate1 tb FROM tmp.timeBusinessCalculate tb
LEFT JOIN tmp.timeControlCalculate1 tc ON tc.userFk = tb.userFk LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk
AND tc.dated = tb.dated AND tc.dated = tb.dated
GROUP BY tb.userFk GROUP BY tb.userFk
HAVING isTeleworkingWeek > 0 HAVING isTeleworkingWeek > 0
@ -360,11 +350,12 @@ module.exports = Self => {
} }
if (tx) await tx.commit(); if (tx) await tx.commit();
return true;
} catch (e) { } catch (e) {
if (tx) await tx.rollback(); if (tx) await tx.rollback();
throw e; throw e;
} }
return true;
}; };
function getStartDateOfWeekNumber(week, year) { function getStartDateOfWeekNumber(week, year) {