Skip to content

Commit 7420217

Browse files
committed
Run planning extraction on progress upload to hydrate problems in that process
1 parent a571f25 commit 7420217

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/components/pnp/extraction-result/pnp-extraction-result.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Module } from '@nestjs/common';
22
import { splitDb2 } from '~/core';
3+
import { ProductModule } from '../../product/product.module';
34
import { PnpExtractionResultProgressReportConnectionResolver } from './pnp-extraction-result-progress-report-connection.resolver';
45
import { PnpExtractionResultRepository } from './pnp-extraction-result.edgedb.repository';
56
import { PnpExtractionResultLoader } from './pnp-extraction-result.loader';
67
import { PnpExtractionResultNeo4jRepository } from './pnp-extraction-result.neo4j.repository';
78
import { SaveProgressExtractionResultHandler } from './save-progress-extraction-result.handler';
89

910
@Module({
11+
imports: [ProductModule],
1012
providers: [
1113
PnpExtractionResultProgressReportConnectionResolver,
1214
PnpExtractionResultLoader,
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
import { EventsHandler } from '~/core';
22
import { PeriodicReportUploadedEvent } from '../../periodic-report/events';
3+
import { ProductStep } from '../../product/dto';
4+
import { PnpProductSyncService } from '../../product/pnp-product-sync.service';
35
import { PnpExtractionResultRepository } from './pnp-extraction-result.edgedb.repository';
46

57
@EventsHandler([PeriodicReportUploadedEvent, -1])
68
export class SaveProgressExtractionResultHandler {
7-
constructor(private readonly repo: PnpExtractionResultRepository) {}
9+
constructor(
10+
private readonly repo: PnpExtractionResultRepository,
11+
private readonly productSyncer: PnpProductSyncService,
12+
) {}
813

914
async handle(event: PeriodicReportUploadedEvent) {
1015
if (!event.pnpResultUsed) {
1116
return;
1217
}
1318

19+
// Parse product/goal sync to hydrate problems from that process.
20+
await this.productSyncer.parse({
21+
engagementId: event.report.parent.properties.id,
22+
// Roll with all the steps to get something since we don't have the actual
23+
// methodology from the user to filter with
24+
availableSteps: [...ProductStep],
25+
pnp: event.file,
26+
result: event.pnpResult,
27+
});
28+
1429
await this.repo.save(event.file.id, event.pnpResult);
1530
}
1631
}

0 commit comments

Comments
 (0)