fix: updateWorkCenter
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
d77730dd47
commit
0a096bc96f
|
@ -7,7 +7,7 @@ CREATE FUNCTION `util`.`mockedDate`()
|
|||
RETURNS DATETIME
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
RETURN '2022-06-15 11:00:00';
|
||||
RETURN '2000-06-15 11:00:00';
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = () => {
|
|||
Date.vnUTC = () => {
|
||||
const env = process.env.NODE_ENV;
|
||||
if (!env || env === 'development')
|
||||
return new Date(Date.UTC(2022, 5, 15, 11));
|
||||
return new Date(Date.UTC(2000, 5, 15, 11));
|
||||
|
||||
return new Date(Date.UTC());
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('Worker getWorkedHours()', () => {
|
||||
fdescribe('Worker getWorkedHours()', () => {
|
||||
it(`should return the expected hours and the worked hours of a given date`, async() => {
|
||||
const workerID = 1106;
|
||||
const started = Date.vnNew();
|
||||
|
|
Loading…
Reference in New Issue