fix: weeklyHourRecordEmail workerId prop and correct request in frontend
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2024-07-17 13:30:47 +02:00
parent 563c70c65d
commit 021d315a01
4 changed files with 6 additions and 6 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

@ -389,7 +389,7 @@ class Controller extends Section {
if (reason) if (reason)
params.reason = reason; params.reason = reason;
const query = `WorkerTimeControls/updateWorkerTimeControlMail`; const query = `WorkerTimeControls/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/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/updateMailState').respond();
controller.isSatisfied(); controller.isSatisfied();
$httpBackend.flush(); $httpBackend.flush();