diff --git a/frontend/src/views/ComplianceReports/components/ComplianceReportSummary.jsx b/frontend/src/views/ComplianceReports/components/ComplianceReportSummary.jsx index c1f7b2c7c..f622a3530 100644 --- a/frontend/src/views/ComplianceReports/components/ComplianceReportSummary.jsx +++ b/frontend/src/views/ComplianceReports/components/ComplianceReportSummary.jsx @@ -54,16 +54,16 @@ const ComplianceReportSummary = ({ onSuccess: (response) => { setSummaryData(response.data) const renewablePenaltyAmount = - response.data?.renewableFuelTargetSummary.find( + response.data?.nonCompliancePenaltySummary.find( (line) => line.line === 11 ) - const lowCarbonPenaltyCredits = - response.data?.lowCarbonFuelTargetSummary.find( - (line) => line.line === 20 + const lowCarbonPenaltyAmount = + response.data?.nonCompliancePenaltySummary.find( + (line) => line.line === 21 ) - setHasMetRenewables(renewablePenaltyAmount.value > 0) - setHasMetLowCarbon(lowCarbonPenaltyCredits.value > 0) + setHasMetRenewables(renewablePenaltyAmount.totalValue <= 0) + setHasMetLowCarbon(lowCarbonPenaltyAmount.totalValue <= 0) }, onError: (error) => { alertRef.current?.triggerAlert({ @@ -75,15 +75,15 @@ const ComplianceReportSummary = ({ useEffect(() => { if (data) { setSummaryData(data) - const renewablePenaltyAmount = data?.renewableFuelTargetSummary.find( + const renewablePenaltyAmount = data?.nonCompliancePenaltySummary.find( (line) => line.line === 11 ) - const lowCarbonPenaltyCredits = data?.lowCarbonFuelTargetSummary.find( - (line) => line.line === 20 + const lowCarbonPenaltyAmount = data?.nonCompliancePenaltySummary.find( + (line) => line.line === 21 ) - setHasMetRenewables(renewablePenaltyAmount.value > 0) - setHasMetLowCarbon(lowCarbonPenaltyCredits.value > 0) + setHasMetRenewables(renewablePenaltyAmount.totalValue <= 0) + setHasMetLowCarbon(lowCarbonPenaltyAmount.totalValue <= 0) setHasRecords(data && data.canSign) } if (isError) { diff --git a/frontend/src/views/ComplianceReports/components/__tests__/ComplianceReportSummary.test.jsx b/frontend/src/views/ComplianceReports/components/__tests__/ComplianceReportSummary.test.jsx index c7af79a82..785e646ff 100644 --- a/frontend/src/views/ComplianceReports/components/__tests__/ComplianceReportSummary.test.jsx +++ b/frontend/src/views/ComplianceReports/components/__tests__/ComplianceReportSummary.test.jsx @@ -116,11 +116,15 @@ describe('ComplianceReportSummary', () => { renewableFuelTargetSummary: [ { line: 1, gasoline: 100, diesel: 100, jetFuel: 100 }, { line: 2, gasoline: 50, diesel: 50, jetFuel: 50 }, - { line: 4, gasoline: 30, diesel: 30, jetFuel: 30 }, - { line: 11, value: 0 } + { line: 3, gasoline: 50, diesel: 50, jetFuel: 50 }, + { line: 4, gasoline: 30, diesel: 30, jetFuel: 30 } ], - lowCarbonFuelTargetSummary: [{ line: 20, value: 0 }], - nonCompliancePenaltySummary: [{ totalValue: 0 }, { totalValue: 0 }] + lowCarbonFuelTargetSummary: [], + nonCompliancePenaltySummary: [ + { line: 11, totalValue: 0 }, + { line: 21, totalValue: 0 }, + { totalValue: 0 } + ] } })