mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-23 08:10:32 +00:00
fix: re-schedule the jobs have date from the current moment
This commit is contained in:
@@ -157,7 +157,6 @@ export default class InventoryService {
|
|||||||
...commonJobsQuery,
|
...commonJobsQuery,
|
||||||
'data.startingDate': { $gte: startingDate },
|
'data.startingDate': { $gte: startingDate },
|
||||||
});
|
});
|
||||||
|
|
||||||
// If the depends jobs cleared.
|
// If the depends jobs cleared.
|
||||||
if (dependsJobs.length === 0) {
|
if (dependsJobs.length === 0) {
|
||||||
await agenda.schedule(
|
await agenda.schedule(
|
||||||
@@ -174,6 +173,13 @@ export default class InventoryService {
|
|||||||
events.inventory.onComputeItemCostJobScheduled,
|
events.inventory.onComputeItemCostJobScheduled,
|
||||||
{ startingDate, itemId, tenantId } as IInventoryItemCostScheduledPayload
|
{ startingDate, itemId, tenantId } as IInventoryItemCostScheduledPayload
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
// Re-schedule the jobs that have higher date from current moment.
|
||||||
|
await Promise.all(
|
||||||
|
dependsJobs.map((job) =>
|
||||||
|
job.schedule(config.scheduleComputeItemCost).save()
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
ISaleInvoiceEditedPayload,
|
ISaleInvoiceEditedPayload,
|
||||||
} from '@/interfaces';
|
} from '@/interfaces';
|
||||||
import { SaleInvoiceGLEntries } from '@/services/Sales/Invoices/InvoiceGLEntries';
|
import { SaleInvoiceGLEntries } from '@/services/Sales/Invoices/InvoiceGLEntries';
|
||||||
import { runAfterTransaction } from '@/services/UnitOfWork/TransactionsHooks';
|
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export default class SaleInvoiceWriteGLEntriesSubscriber {
|
export default class SaleInvoiceWriteGLEntriesSubscriber {
|
||||||
|
|||||||
Reference in New Issue
Block a user