This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Bb 276 implement calculate util (#287)
* Add CalculationTable Interface * Move SubmissionValues to crops It's only being used there, makes sense to have it only there * Add Calculate Util * Call Calculate from Fertilizer Next button * Update Crops validationSchema max values * camelCase it * Lint * Console log calculation * Implement CropRemoval Calculation * Removed debug console.logs Crop removal was done but console was printing wrong results... A page refresh fixed this issue... * Fixed crop removal calculation when removing from field It should simply add the coeficient, not add the Yield * coeficient * Cleanup * Lint * Update Husky to check build before push
- Loading branch information
Showing
17 changed files
with
284 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ cd frontend | |
npm run test | ||
npm run format | ||
npm run lint | ||
npm run build | ||
|
||
cd ../backend | ||
npm run test | ||
|
2 changes: 1 addition & 1 deletion
2
frontend/src/Commons/Forms/InputModules/Calculation/CalculationList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
interface AgronomicBalanceInterface { | ||
N: number; | ||
P: number; | ||
K: number; | ||
} | ||
|
||
export default AgronomicBalanceInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
interface NutrientRange { | ||
min?: number; | ||
max?: number; | ||
addition: number; | ||
} | ||
|
||
interface SoilTestRange { | ||
min?: number; | ||
max?: number; | ||
leafTissueRanges?: NutrientRange[]; | ||
} | ||
|
||
interface Params { | ||
sawdust?: string; | ||
Yield?: string; | ||
soilTest?: string; | ||
leafTissue?: string; | ||
Pruned?: string; | ||
Removed?: string; | ||
} | ||
|
||
export interface CalcLogic { | ||
sawdustAddition?: number; | ||
yieldRanges?: NutrientRange[]; | ||
soilTestRanges?: SoilTestRange[]; | ||
N?: number; | ||
P?: number; | ||
K?: number; | ||
fruitRemovalFactor?: number; | ||
pruningRemovalFactor?: number; | ||
} | ||
|
||
interface Calculation { | ||
description: string; | ||
params: Params; | ||
logic: CalcLogic; | ||
} | ||
|
||
interface AgronomicBalance { | ||
nitrogenCalculation: Calculation; | ||
phosphorusCalculation: Calculation; | ||
potassiumCalculation: Calculation; | ||
} | ||
|
||
export interface CropRemovalCoeficient { | ||
phosphorusRemoval: Calculation; | ||
potassiumRemoval: Calculation; | ||
} | ||
|
||
interface CalculationTable { | ||
cropType: string; | ||
crop: string; | ||
agronomicBalance: AgronomicBalance; | ||
cropRemovalBalance: CropRemovalCoeficient; | ||
} | ||
|
||
export default CalculationTable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
interface CropRemovalBalanceInterface { | ||
P: number; | ||
K: number; | ||
} | ||
|
||
export default CropRemovalBalanceInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.