refactor: endpoint
This commit is contained in:
parent
626355d251
commit
98cc2b5866
|
@ -2715,19 +2715,6 @@ UPDATE `account`.`user`
|
|||
SET `hasGrant` = 1
|
||||
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`)
|
||||
VALUES
|
||||
|
|
|
@ -72,9 +72,6 @@ module.exports = Self => {
|
|||
|
||||
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.timeControlCalculate1');
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate1');
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.error');
|
||||
|
||||
if (args.workerId) {
|
||||
await models.WorkerTimeControl.destroyAll({
|
||||
|
@ -122,12 +119,6 @@ module.exports = Self => {
|
|||
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(`
|
||||
SELECT CONCAT(u.name, '@verdnatura.es') receiver,
|
||||
u.id workerFk,
|
||||
|
@ -147,13 +138,12 @@ module.exports = Self => {
|
|||
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 worker w ON w.id = u.id
|
||||
LEFT JOIN user u2 ON u2.id = w.bossFk
|
||||
JOIN (SELECT tb.userFk,
|
||||
SUM(IF(tb.type IS NULL,
|
||||
IF(tc.timeWorkDecimal > 0, FALSE, IF(tb.timeWorkDecimal > 0, TRUE, FALSE)),
|
||||
TRUE))isTeleworkingWeek
|
||||
FROM tmp.timeBusinessCalculate1 tb
|
||||
LEFT JOIN tmp.timeControlCalculate1 tc ON tc.userFk = tb.userFk
|
||||
FROM tmp.timeBusinessCalculate tb
|
||||
LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk
|
||||
AND tc.dated = tb.dated
|
||||
GROUP BY tb.userFk
|
||||
HAVING isTeleworkingWeek > 0
|
||||
|
@ -360,11 +350,12 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
function getStartDateOfWeekNumber(week, year) {
|
||||
|
|
Loading…
Reference in New Issue