Skip to content

Commit

Permalink
Fix implementation labor type problem
Browse files Browse the repository at this point in the history
  • Loading branch information
catalin-oancea committed Dec 17, 2024
1 parent 885dec6 commit 8782aeb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/src/modules/calculations/data.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export class DataRepository extends Repository<BaseDataView> {
break;
}
queryBuilder.select(
queryBuilder.alias + '.' + implementationLaborToSelect,
queryBuilder.alias + '.' + implementationLaborToSelect + ' :: float',
'implementationLabor',
);
}
Expand Down
38 changes: 36 additions & 2 deletions api/test/integration/custom-projects/custom-projects-setup.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { TestManager } from '../../utils/test-manager';
import { customProjectContract } from '@shared/contracts/custom-projects.contract';
import { ECOSYSTEM } from '@shared/entities/ecosystem.enum';
import { ACTIVITY } from '@shared/entities/activity.enum';
import {
ACTIVITY,
RESTORATION_ACTIVITY_SUBTYPE,
} from '@shared/entities/activity.enum';

describe('Create Custom Projects - Setup', () => {
let testManager: TestManager;
Expand Down Expand Up @@ -67,7 +70,7 @@ describe('Create Custom Projects - Setup', () => {
expect(response.body.data).toHaveLength(9);
});

test('Should return default cost inputs given required filters', async () => {
test('[Conservation] Should return default cost inputs given required filters', async () => {
const response = await testManager
.request()
.get(customProjectContract.getDefaultCostInputs.path)
Expand Down Expand Up @@ -96,4 +99,35 @@ describe('Create Custom Projects - Setup', () => {
longTermProjectOperatingCost: 22200,
});
});

test('[Restoration] Should return default cost inputs given required filters', async () => {
const response = await testManager
.request()
.get(customProjectContract.getDefaultCostInputs.path)
.query({
countryCode: 'IND',
ecosystem: ECOSYSTEM.SEAGRASS,
activity: ACTIVITY.RESTORATION,
restorationActivity: RESTORATION_ACTIVITY_SUBTYPE.PLANTING,
});

expect(response.body.data).toMatchObject({
feasibilityAnalysis: 50000,
conservationPlanningAndAdmin: 166766.666666667,
dataCollectionAndFieldCost: 26666.6666666667,
communityRepresentation: 67633.3333333333,
blueCarbonProjectPlanning: 100000,
establishingCarbonRights: 46666.6666666667,
financingCost: 0.05,
validation: 50000,
implementationLabor: 1879.13529321225,
monitoring: 8400,
maintenance: 0.0833,
carbonStandardFees: 0.2,
communityBenefitSharingFund: 0.5,
baselineReassessment: 40000,
mrv: 75000,
longTermProjectOperatingCost: 22200,
});
});
});

0 comments on commit 8782aeb

Please sign in to comment.