refs #6013 refactor: siempre se crea una tranacción para cada dia
gitea/salix/pipeline/head Build queued...
Details
gitea/salix/pipeline/head Build queued...
Details
This commit is contained in:
parent
c7c17e6e4a
commit
beeebbdf9c
|
@ -180,10 +180,8 @@ module.exports = Self => {
|
||||||
const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions);
|
const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions);
|
||||||
|
|
||||||
for (let day of days[index]) {
|
for (let day of days[index]) {
|
||||||
if (!myOptions.transaction) {
|
|
||||||
tx = await Self.beginTransaction({});
|
tx = await Self.beginTransaction({});
|
||||||
myOptions.transaction = tx;
|
myOptions.transaction = tx;
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
workerFk = day.workerFk;
|
workerFk = day.workerFk;
|
||||||
if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null
|
if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null
|
||||||
|
@ -368,10 +366,7 @@ module.exports = Self => {
|
||||||
previousReceiver = day.receiver;
|
previousReceiver = day.receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx) {
|
if (tx) await tx.commit();
|
||||||
await tx.commit();
|
|
||||||
delete myOptions.transaction;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const stmts = [];
|
const stmts = [];
|
||||||
let stmt;
|
let stmt;
|
||||||
|
@ -394,7 +389,6 @@ module.exports = Self => {
|
||||||
previousReceiver = day.receiver;
|
previousReceiver = day.receiver;
|
||||||
|
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
delete myOptions.transaction;
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue