fix(updateWorkCenter): use vnNew()
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
6c772643a8
commit
8a50c56284
|
@ -7,7 +7,7 @@ CREATE FUNCTION `util`.`mockedDate`()
|
|||
RETURNS DATETIME
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
RETURN '2001-01-01 11:00:00';
|
||||
RETURN CONVERT_TZ('2001-01-01 11:00:00', 'utc', 'Europe/Madrid');
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
|
||||
|
|
|
@ -33,12 +33,13 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
const date = Date.vnNew();
|
||||
const [result] = await Self.rawSql(`
|
||||
SELECT IFNULL(wl.workCenterFk, r.defaultWorkCenterFk) AS commissionWorkCenter
|
||||
FROM vn.routeConfig r
|
||||
LEFT JOIN vn.workerLabour wl ON wl.workerFk = ?
|
||||
AND CURDATE() BETWEEN wl.started AND IFNULL(wl.ended, CURDATE());
|
||||
`, [userId], myOptions);
|
||||
AND ? BETWEEN wl.started AND IFNULL(wl.ended, ?);
|
||||
`, [userId, date, date], myOptions);
|
||||
|
||||
const route = await models.Route.findById(id, null, myOptions);
|
||||
await route.updateAttribute('commissionWorkCenterFk', result.commissionWorkCenter, myOptions);
|
||||
|
|
Loading…
Reference in New Issue