diff --git a/app/hooks/scenarios/index.ts b/app/hooks/scenarios/index.ts index 0ce67dc4a1..12862126d1 100644 --- a/app/hooks/scenarios/index.ts +++ b/app/hooks/scenarios/index.ts @@ -574,6 +574,7 @@ export function useScenarioPU( excluded: ScenarioPlanningUnit['id'][]; included: ScenarioPlanningUnit['id'][]; available: ScenarioPlanningUnit['id'][]; + total: number; } > ) { @@ -613,11 +614,13 @@ export function useScenarioPU( const available = data .filter((p) => p.inclusionStatus === 'available' && p.setByUser) .map((p) => p.id); + const total = data.length; return { included, excluded, available, + total, }; }, ...queryOptions, diff --git a/app/layout/scenarios/edit/map/legend/hooks/index.ts b/app/layout/scenarios/edit/map/legend/hooks/index.ts index dbe6337e00..3c8fc7446b 100644 --- a/app/layout/scenarios/edit/map/legend/hooks/index.ts +++ b/app/layout/scenarios/edit/map/legend/hooks/index.ts @@ -13,6 +13,7 @@ import { useAllGapAnalysis } from 'hooks/gap-analysis'; import { LEGEND_LAYERS } from 'hooks/map/constants'; import { useProject } from 'hooks/projects'; import { useScenario } from 'hooks/scenarios'; +import { useSolutions } from 'hooks/solutions'; import { useWDPACategories } from 'hooks/wdpa'; import { CostSurface } from 'types/api/cost-surface'; @@ -417,6 +418,7 @@ export const useFrequencyLegend = () => { const { query } = useRouter(); const { sid } = query as { sid: string }; const scenarioQuery = useScenario(sid); + const solutionsQuery = useSolutions(sid); const dispatch = useAppDispatch(); const scenarioSlice = getScenarioEditSlice(sid); @@ -426,7 +428,7 @@ export const useFrequencyLegend = () => { if (!scenarioQuery.data?.ranAtLeastOnce) return null; return LEGEND_LAYERS['frequency']({ - numberOfRuns: scenarioQuery.data?.numberOfRuns, + numberOfRuns: solutionsQuery.data.length, onChangeVisibility: () => { dispatch( setLayerSettings({ diff --git a/app/layout/scenarios/reports/solutions/frequency/index.tsx b/app/layout/scenarios/reports/solutions/frequency/index.tsx index 39e8c3b983..9871b826fe 100644 --- a/app/layout/scenarios/reports/solutions/frequency/index.tsx +++ b/app/layout/scenarios/reports/solutions/frequency/index.tsx @@ -4,6 +4,7 @@ import { useRouter } from 'next/router'; import { LEGEND_LAYERS } from 'hooks/map/constants'; import { useScenario } from 'hooks/scenarios'; +import { useSolutions } from 'hooks/solutions'; import LegendItem from 'components/map/legend/item'; import LegendTypeGradient from 'components/map/legend/types/gradient'; @@ -15,12 +16,13 @@ export const FrequencyPage = (): JSX.Element => { const scenarioQuery = useScenario(sid); + const solutionsQuery = useSolutions(sid); + const LEGEND = useMemo(() => { return { ...LEGEND_LAYERS.frequency({ - numberOfRuns: scenarioQuery.data?.numberOfRuns, + numberOfRuns: solutionsQuery.data.length, }), - name: `Frequency (${scenarioQuery.data?.numberOfRuns})`, settingsManager: null, }; }, [scenarioQuery.data?.numberOfRuns]); @@ -29,7 +31,12 @@ export const FrequencyPage = (): JSX.Element => {
Lorem Ipsum
+{costSurfaceQuery.data?.name}
{projectQuery.data?.planningUnitAreakm2}
{projectQuery.data?.planningUnitGridShape}
)} - -Lorem Ipsum
-Lorem Ipsum
++ {protectedAreaQuery.data?.map(({ name }) => name).join(', ')} +
Total: {PUDataQuery.data?.available.length}
+Available PU: {PUDataQuery.data?.available.length}
Included PU: {PUDataQuery.data?.included.length}
Excluded PU: {PUDataQuery.data?.excluded.length}
+Total PU: {PUDataQuery.data?.total}