mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +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,
|
||||
'data.startingDate': { $gte: startingDate },
|
||||
});
|
||||
|
||||
// If the depends jobs cleared.
|
||||
if (dependsJobs.length === 0) {
|
||||
await agenda.schedule(
|
||||
@@ -174,6 +173,13 @@ export default class InventoryService {
|
||||
events.inventory.onComputeItemCostJobScheduled,
|
||||
{ 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,
|
||||
} from '@/interfaces';
|
||||
import { SaleInvoiceGLEntries } from '@/services/Sales/Invoices/InvoiceGLEntries';
|
||||
import { runAfterTransaction } from '@/services/UnitOfWork/TransactionsHooks';
|
||||
|
||||
@Service()
|
||||
export default class SaleInvoiceWriteGLEntriesSubscriber {
|
||||
|
||||
Reference in New Issue
Block a user