Fixed error with compliance page
This commit is contained in:
@@ -114,6 +114,20 @@ export const ExecutiveDashboard: React.FC = () => {
|
||||
queryFn: () => getAllIndicators(),
|
||||
});
|
||||
|
||||
// Filtered projects according to active Programme and Sector dropdown selections
|
||||
const filteredProjects = useMemo(() => {
|
||||
return projects.filter((p) => {
|
||||
if (selectedProgramme !== 'All' && String(p.programmeId) !== selectedProgramme) {
|
||||
return false;
|
||||
}
|
||||
if (selectedSector !== 'All') {
|
||||
const sectorLabel = getIndustrySectorLabel(p.sector);
|
||||
if (sectorLabel !== selectedSector) return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}, [projects, selectedProgramme, selectedSector]);
|
||||
|
||||
const { data: projectComplianceMap = new Map<string | number, any[]>() } = useQuery({
|
||||
queryKey: ['projectComplianceMap', filteredProjects.map((p) => p.id)],
|
||||
queryFn: async () => {
|
||||
@@ -138,20 +152,6 @@ export const ExecutiveDashboard: React.FC = () => {
|
||||
queryClient.invalidateQueries();
|
||||
};
|
||||
|
||||
// Filtered projects according to active Programme and Sector dropdown selections
|
||||
const filteredProjects = useMemo(() => {
|
||||
return projects.filter((p) => {
|
||||
if (selectedProgramme !== 'All' && String(p.programmeId) !== selectedProgramme) {
|
||||
return false;
|
||||
}
|
||||
if (selectedSector !== 'All') {
|
||||
const sectorLabel = getIndustrySectorLabel(p.sector);
|
||||
if (sectorLabel !== selectedSector) return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}, [projects, selectedProgramme, selectedSector]);
|
||||
|
||||
// Filtered risks associated with the filtered project set
|
||||
const filteredRisks = useMemo(() => {
|
||||
if (selectedProgramme === 'All' && selectedSector === 'All') {
|
||||
|
||||
Reference in New Issue
Block a user