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 8bebca9f9a..19e49e730f 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 @@ -398,12 +398,6 @@ export class FeatureAmountUploadService { `, parameters, ); - await geoQueryRunner.manager.query( - ` INSERT INTO feature_amounts_per_planning_unit (project_id, feature_id, amount, project_pu_id) - SELECT $1, $2, amount, project_pu_id - FROM features_data where feature_id = $2`, - [projectId, newFeature.id], - ); this.logger.log( `Chunk ${amountIndex}/${featuresChunks.length} saved to (geoDB).features_data`, ); @@ -411,6 +405,13 @@ export class FeatureAmountUploadService { this.logger.log( `All chunks of feature ${newFeature.feature_class_name} saved`, ); + + await geoQueryRunner.manager.query( + `INSERT INTO feature_amounts_per_planning_unit (project_id, feature_id, amount, project_pu_id) + SELECT $1, $2, amount, project_pu_id + FROM features_data where feature_id = $2`, + [projectId, newFeature.id], + ); } this.logger.log( `Data for all new features was saved to (geoDB).features_data`,