diff --git a/api/libs/feature-amounts-per-planning-unit/src/repository/memory-feature-amounts-per-planning-unit.repository.ts b/api/libs/feature-amounts-per-planning-unit/src/repository/memory-feature-amounts-per-planning-unit.repository.ts index a5a30f6faa..24ab06806c 100644 --- a/api/libs/feature-amounts-per-planning-unit/src/repository/memory-feature-amounts-per-planning-unit.repository.ts +++ b/api/libs/feature-amounts-per-planning-unit/src/repository/memory-feature-amounts-per-planning-unit.repository.ts @@ -26,8 +26,12 @@ export class MemoryFeatureAmountsPerPlanningUnitRepository if (!featureAmountsPerPlanningUnit) return []; - return featureAmountsPerPlanningUnit.filter(({ featureId }) => - featureIds.includes(featureId), + return ( + featureAmountsPerPlanningUnit + .filter(({ featureId }) => featureIds.includes(featureId)) + /** The Marxan solver will show unexpected behaviour when seeing + * puvspr.dat rows with amount = 0 */ + .filter(({ amount }) => amount > 0) ); } async saveAmountPerPlanningUnitAndFeature( diff --git a/api/libs/feature-amounts-per-planning-unit/src/repository/typeorm-feature-amounts-per-planning-unit.repository.ts b/api/libs/feature-amounts-per-planning-unit/src/repository/typeorm-feature-amounts-per-planning-unit.repository.ts index 5fe71e9284..253f906855 100644 --- a/api/libs/feature-amounts-per-planning-unit/src/repository/typeorm-feature-amounts-per-planning-unit.repository.ts +++ b/api/libs/feature-amounts-per-planning-unit/src/repository/typeorm-feature-amounts-per-planning-unit.repository.ts @@ -40,6 +40,9 @@ export class TypeormFeatureAmountsPerPlanningUnitRepository .from(FeatureAmountsPerPlanningUnitEntity, 'fappu') .where('project_id = :projectId', { projectId }) .andWhere('feature_id IN (:...featureIds)', { featureIds }) + /** The Marxan solver will show unexpected behaviour when seeing + * puvspr.dat rows with amount = 0 */ + .andWhere('amount > 0') .execute(); }