Skip to content

Commit

Permalink
Fix GeoFeaturesService.saveAmountRangeForFeatures() query
Browse files Browse the repository at this point in the history
  • Loading branch information
yulia-bel committed Oct 19, 2023
1 parent d00eba0 commit 7172b6a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions api/apps/api/src/modules/geo-features/geo-features.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -843,12 +843,15 @@ export class GeoFeaturesService extends AppBaseService<
const minAndMaxAmountsForFeatures = await this.geoEntityManager
.createQueryBuilder()
.select('feature_id', 'id')
.select('MIN(amount)', 'amountMin')
.addSelect('MIN(amount)', 'amountMin')
.addSelect('MAX(amount)', 'amountMax')
.from('puvspr_calculations', 'puvspr')
.where('puvspr.feature_id IN (:...featureIds)', { featureIds })
.getMany();
.groupBy('puvspr.feature_id')
.getRawMany();

await this.geoFeaturesRepository.save(minAndMaxAmountsForFeatures);
await this.geoFeaturesRepository.upsert(minAndMaxAmountsForFeatures, [
'id',
]);
}
}

0 comments on commit 7172b6a

Please sign in to comment.