fix: incorrect number of params
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
273a8cd7c7
commit
1f2ea2c4d8
|
@ -100,10 +100,14 @@ module.exports = Self => {
|
|||
updated: new Date(), state: 'SENDED'
|
||||
}, myOptions);
|
||||
|
||||
stmt = new ParameterizedSQL(`CALL vn.timeControl_calculateAll(?, ?)`, [args.workerId, started, ended]);
|
||||
stmt = new ParameterizedSQL(
|
||||
`CALL vn.timeControl_calculateByUser(?, ?, ?)
|
||||
`, [args.workerId, started, ended]);
|
||||
stmts.push(stmt);
|
||||
|
||||
stmt = new ParameterizedSQL(`CALL vn.timeBusiness_calculateAll(?, ?)`, [args.workerId, started, ended]);
|
||||
stmt = new ParameterizedSQL(
|
||||
`CALL vn.timeBusiness_calculateByUser(?, ?, ?)
|
||||
`, [args.workerId, started, ended]);
|
||||
stmts.push(stmt);
|
||||
} else {
|
||||
await models.WorkerTimeControl.destroyAll({
|
||||
|
@ -132,41 +136,43 @@ module.exports = Self => {
|
|||
stmts.push(`CREATE TEMPORARY TABLE tmp.timeBusinessCalculate1
|
||||
SELECT * FROM tmp.timeBusinessCalculate`);
|
||||
|
||||
const index = stmts.push(`
|
||||
SELECT CONCAT(u.name, '@verdnatura.es'),
|
||||
u.id workerFk,
|
||||
tb.dated,
|
||||
tb.timeWorkDecimal,
|
||||
tb.timeWorkSexagesimal timeWorkSexagesimal,
|
||||
tb.timeTable,
|
||||
tc.timeWorkDecimal timeWorkedDecimal,
|
||||
tc.timeWorkSexagesimal timeWorkedSexagesimal,
|
||||
tb.type,
|
||||
tb.businessFk,
|
||||
tb.permissionRate,
|
||||
d.isTeleworking
|
||||
FROM tmp.timeBusinessCalculate tb
|
||||
JOIN user u ON u.id = tb.userFk
|
||||
JOIN department d ON d.id = tb.departmentFk
|
||||
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
|
||||
AND tc.dated = tb.dated
|
||||
GROUP BY tb.userFk
|
||||
HAVING isTeleworkingWeek > 0
|
||||
)sub ON sub.userFk = u.id
|
||||
WHERE d.hasToRefill
|
||||
-- AND IFNULL(vWorkerFk, u.id) = u.id
|
||||
AND b.companyCodeFk = 'VNL'
|
||||
AND w.businessFk
|
||||
ORDER BY u.id, tb.dated`) - 1;
|
||||
stmt = new ParameterizedSQL(`
|
||||
SELECT CONCAT(u.name, '@verdnatura.es'),
|
||||
u.id workerFk,
|
||||
tb.dated,
|
||||
tb.timeWorkDecimal,
|
||||
tb.timeWorkSexagesimal timeWorkSexagesimal,
|
||||
tb.timeTable,
|
||||
tc.timeWorkDecimal timeWorkedDecimal,
|
||||
tc.timeWorkSexagesimal timeWorkedSexagesimal,
|
||||
tb.type,
|
||||
tb.businessFk,
|
||||
tb.permissionRate,
|
||||
d.isTeleworking
|
||||
FROM tmp.timeBusinessCalculate tb
|
||||
JOIN user u ON u.id = tb.userFk
|
||||
JOIN department d ON d.id = tb.departmentFk
|
||||
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
|
||||
AND tc.dated = tb.dated
|
||||
GROUP BY tb.userFk
|
||||
HAVING isTeleworkingWeek > 0
|
||||
)sub ON sub.userFk = u.id
|
||||
WHERE d.hasToRefill
|
||||
AND IFNULL(?, u.id) = u.id
|
||||
AND b.companyCodeFk = 'VNL'
|
||||
AND w.businessFk
|
||||
ORDER BY u.id, tb.dated
|
||||
`, [args.workerId]);
|
||||
const index = stmts.push(stmt) - 1;
|
||||
|
||||
const sql = ParameterizedSQL.join(stmts, ';');
|
||||
const days = await conn.executeStmt(sql, myOptions);
|
||||
|
|
Loading…
Reference in New Issue