Skip to content

Commit

Permalink
fix: made corrections to industrial waste formula
Browse files Browse the repository at this point in the history
  • Loading branch information
isaaccodekill committed Jan 30, 2025
1 parent 215ca0e commit a174243
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
10 changes: 2 additions & 8 deletions app/src/backend/formulas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,15 +598,9 @@ export async function handleIndustrialWasteWaterFormula(

const totalIndustrialProduction = data["total-industry-production"];
const industryType = data[`${prefixKey}-industry-type`];
const treatmentType = data[`${prefixKey}-treatment-type-collected-treated`];
const treatmentType = data[`${prefixKey}-treatment-type`];
const treatmentStatus = data[`${prefixKey}-treatment-status`];
const dischargePathway = data[`${prefixKey}-discharge-pathway-untreated`];
const treatmentTypeMetaDataFilter =
treatmentStatus === "treatment-status-type-wastewater-untreated"
? dischargePathway
: treatmentType;
let wastewaterGenerated = data[`${prefixKey}-wastewater-generated`]; // should this be gotten from UI or
const country = inventoryValue.inventory.city.country as string;
const countryCode = inventoryValue.inventory.city.countryLocode;
const formulaInputsDOC = await db.models.FormulaInput.findOne({
where: {
Expand Down Expand Up @@ -657,7 +651,7 @@ export async function handleIndustrialWasteWaterFormula(

const formulaInputMCF = await db.models.FormulaInput.findOne({
where: {
[`metadata.treatment-type`]: treatmentTypeMetaDataFilter as string,
[`metadata.treatment-type`]: treatmentType as string,
[`metadata.treatment-status`]: treatmentStatus as string,
gas: "CH4",
parameterCode: "MCF",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ const ActivityModalBody = ({
required:
f.required === false
? false
: t("value-required"),
: t("option-required"),
})}
>
{f.units?.map((item: string) => (
Expand All @@ -361,7 +361,7 @@ const ActivityModalBody = ({
""
)}
{(errors?.activity?.[`${f.id}-unit`] as any) &&
!errors?.activity?.[`${f.id}-unit`] ? (
!errors?.activity?.[`${f.id}`] ? (
<Box
display="flex"
gap="6px"
Expand All @@ -370,6 +370,7 @@ const ActivityModalBody = ({
>
<WarningIcon color="sentiment.negativeDefault" />
<Text fontSize="body.md">
{" "}
{errors?.activity?.[`${f.id}-unit`]?.message}{" "}
</Text>
</Box>
Expand Down
5 changes: 3 additions & 2 deletions app/src/util/form-schema/manual-input-hierarchy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4544,6 +4544,7 @@
"extra-fields": [
{
"id": "wastewater-inside-industrial-calculator-industry-type",
"required": true,
"options": [
"industry-type-alcohol-refining",
"industry-type-coffee",
Expand Down Expand Up @@ -4623,8 +4624,8 @@
}
},
{
"id": "wastewater-inside-industrial-calculator-treatment-name",
"dependsOn": "wastewater-inside-industrial-calculator-treatment-type",
"id": "wastewater-inside-industrial-calculator-treatment-type",
"dependsOn": "wastewater-inside-industrial-calculator-treatment-name",
"dependentOptions": {
"treatment-name-septic-system": [
"treatment-type-septic-system"
Expand Down

0 comments on commit a174243

Please sign in to comment.