Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2024-07-17 14:17:17 +02:00
commit a1f481deb1
4 changed files with 6 additions and 7 deletions

View File

@ -165,8 +165,8 @@ module.exports = Self => {
const sql = ParameterizedSQL.join(stmts, ';'); const sql = ParameterizedSQL.join(stmts, ';');
const days = await conn.executeStmt(sql, myOptions); const days = await conn.executeStmt(sql, myOptions);
let previousWorkerFk = days[index][0].workerFk; let previousWorkerFk = days[index][0]?.workerFk;
let previousReceiver = days[index][0].receiver; let previousReceiver = days[index][0]?.receiver;
const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions); const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions);

View File

@ -61,7 +61,7 @@ module.exports = Self => {
const url = `${salix.url}worker/${args.workerId}/time-control?timestamp=${timestamp}`; const url = `${salix.url}worker/${args.workerId}/time-control?timestamp=${timestamp}`;
ctx.args.url = url; ctx.args.url = url;
await models.WorkerTimeControl.updateMailState(ctx, ctx.workerId, myOptions); await models.WorkerTimeControl.updateMailState(ctx, ctx.args.workerId, myOptions);
return Self.sendTemplate(ctx, 'weekly-hour-record'); return Self.sendTemplate(ctx, 'weekly-hour-record');
}; };

View File

@ -380,7 +380,6 @@ class Controller extends Section {
updateWorkerTimeControlMail(state, reason) { updateWorkerTimeControlMail(state, reason) {
const params = { const params = {
workerId: this.worker.id,
year: this.date.getFullYear(), year: this.date.getFullYear(),
week: this.weekNumber, week: this.weekNumber,
state state
@ -389,7 +388,7 @@ class Controller extends Section {
if (reason) if (reason)
params.reason = reason; params.reason = reason;
const query = `WorkerTimeControls/updateWorkerTimeControlMail`; const query = `WorkerTimeControls/${this.worker.id}/updateMailState`;
this.$http.post(query, params).then(() => { this.$http.post(query, params).then(() => {
this.getMailStates(this.date); this.getMailStates(this.date);
this.getWeekData(); this.getWeekData();

View File

@ -201,7 +201,7 @@ describe('Component vnWorkerTimeControl', () => {
controller.date = today; controller.date = today;
controller.weekNumber = 1; controller.weekNumber = 1;
$httpBackend.expect('POST', 'WorkerTimeControls/updateWorkerTimeControlMail').respond(); $httpBackend.expect('POST', 'WorkerTimeControls/1/updateMailState').respond();
controller.isSatisfied(); controller.isSatisfied();
$httpBackend.flush(); $httpBackend.flush();
@ -236,7 +236,7 @@ describe('Component vnWorkerTimeControl', () => {
controller.weekNumber = 1; controller.weekNumber = 1;
controller.reason = 'reason'; controller.reason = 'reason';
$httpBackend.expect('POST', 'WorkerTimeControls/updateWorkerTimeControlMail').respond(); $httpBackend.expect('POST', 'WorkerTimeControls/1/updateMailState').respond();
controller.isSatisfied(); controller.isSatisfied();
$httpBackend.flush(); $httpBackend.flush();