From b57c969d5ac03a98369dc43ff637ec89657c190e Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 25 Oct 2023 17:24:34 +0200 Subject: [PATCH] feature(Feature Amounts): Undoes hack of setting legacy_import to project for puvspr shapefile uploads --- .../import/features-amounts-upload.service.ts | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/api/apps/api/src/modules/geo-features/import/features-amounts-upload.service.ts b/api/apps/api/src/modules/geo-features/import/features-amounts-upload.service.ts index 75f31629c9..63526c1bc1 100644 --- a/api/apps/api/src/modules/geo-features/import/features-amounts-upload.service.ts +++ b/api/apps/api/src/modules/geo-features/import/features-amounts-upload.service.ts @@ -24,9 +24,6 @@ import { chunk } from 'lodash'; import { Left } from 'fp-ts/lib/Either'; import { CHUNK_SIZE_FOR_BATCH_APIDB_OPERATIONS } from '@marxan-api/utils/chunk-size-for-batch-apidb-operations'; import { UploadedFeatureAmount } from '@marxan-api/modules/geo-features/import/features-amounts-data.api.entity'; -import { Project } from '@marxan-api/modules/projects/project.api.entity'; -import { ProjectSourcesEnum } from '@marxan/projects'; -import { ScenariosService } from '@marxan-api/modules/scenarios/scenarios.service'; @Injectable() export class FeatureAmountUploadService { @@ -109,22 +106,13 @@ export class FeatureAmountUploadService { this.logger.log( `Upload temporary data removed from apiDB uploads tables`, ); - // Setting project source to legacy-import to create puvspr.dat files from pre-calculated amounts, to allow to use new features after upload - this.logger.log(`Updating project sources value to legacy-import...`); - await this.updateProjectSources( - data.projectId, - ProjectSourcesEnum.legacyImport, - apiQueryRunner.manager, - ); - - this.logger.log(`Saving min and max amounts for new features...`); this.logger.log(`Csv file upload process finished successfully`); // Committing transaction - await apiQueryRunner.commitTransaction(); await geoQueryRunner.commitTransaction(); + this.logger.log(`Saving min and max amounts for new features...`); await this.geoFeaturesService.saveAmountRangeForFeatures( newFeaturesFromCsvUpload.map((feature) => feature.id), ); @@ -401,17 +389,4 @@ export class FeatureAmountUploadService { return { featureNames: Array.from(featureNames), puids: Array.from(puids) }; } - - private async updateProjectSources( - projectId: string, - sources: ProjectSourcesEnum, - entityManager: EntityManager, - ) { - await entityManager - .createQueryBuilder() - .update(Project) - .set({ sources }) - .where('id = :projectId', { projectId }) - .execute(); - } }