fix: borrada propiedad transaction cuando se hace commit
This commit is contained in:
parent
38e4349e17
commit
92a9004d98
|
@ -161,8 +161,10 @@ module.exports = Self => {
|
|||
const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions);
|
||||
|
||||
for (let day of days[index]) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
try {
|
||||
workerFk = day.workerFk;
|
||||
if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null
|
||||
|
@ -346,7 +348,10 @@ module.exports = Self => {
|
|||
previousReceiver = day.receiver;
|
||||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
if (tx) {
|
||||
await tx.commit();
|
||||
delete myOptions.transaction;
|
||||
}
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
|
|
Loading…
Reference in New Issue