Skip to content

Commit

Permalink
Merge pull request #3512 from bcgov/NDT-474-refine-filter-drop-down-o…
Browse files Browse the repository at this point in the history
…rder

fix: status orders on all dashboard table
  • Loading branch information
rafasdc authored Sep 4, 2024
2 parents 0815b0d + 678ead3 commit 20ca1dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.190.8](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.190.7...v1.190.8) (2024-09-04)

### Bug Fixes

- status order ([ef3d679](https://github.com/bcgov/CONN-CCBC-portal/commit/ef3d67989c495d887d642d2e3c6d848aceac4dec))

## [1.190.7](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.190.6...v1.190.7) (2024-09-04)

## [1.190.6](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.190.5...v1.190.6) (2024-09-04)
Expand Down
17 changes: 12 additions & 5 deletions app/components/AnalystDashboard/AllDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
const statusOrderMap = useMemo(() => {
return allApplicationStatusTypes?.nodes?.reduce((acc, status) => {
acc[status.name] = status.statusOrder;
acc[normalizeStatusName(status.name)] = status.statusOrder;
return acc;
}, {});
}, [allApplicationStatusTypes?.nodes]);
Expand Down Expand Up @@ -467,7 +468,11 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
allApplications.edges.map((edge) => edge.node?.intakeNumber?.toString())
),
'N/A',
];
].toSorted((a, b) => {
if (a === 'N/A') return -1;
if (b === 'N/A') return 1;
return Number(a) - Number(b);
});

const uniqueZones = [
...new Set(allApplications.edges.flatMap((edge) => edge.node.zones)),
Expand All @@ -481,7 +486,7 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
return normalizeStatusName(edge.node.analystStatus);
})
),
];
].toSorted((a, b) => statusOrderMap[a] - statusOrderMap[b]);

const externalStatuses = [
...new Set([
Expand All @@ -494,7 +499,7 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
normalizeStatusName(cbcProjectStatusConverter(status))
),
]),
];
].toSorted((a, b) => statusOrderMap[a] - statusOrderMap[b]);

const uniqueLeads = [
...new Set(allApplications.edges.map((edge) => edge.node.analystLead)),
Expand All @@ -504,7 +509,9 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
...new Set(
allApplications.edges.map((edge) => edge.node.package?.toString())
),
].filter(filterOutNullishs);
]
.filter(filterOutNullishs)
.toSorted((a, b) => Number(a) - Number(b));

return [
{
Expand Down Expand Up @@ -570,7 +577,7 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
// adding dummy columns for filter purposes
...additionalFilterColumns,
];
}, [AssignAnalystLead, allApplications]);
}, [AssignAnalystLead, allApplications, statusOrderMap]);

const handleOnSortChange = (sort: MRT_SortingState) => {
if (!isFirstRender) {
Expand Down
1 change: 1 addition & 0 deletions db/sqitch.plan
Original file line number Diff line number Diff line change
Expand Up @@ -665,3 +665,4 @@ tables/communities_source_data_001_service_account 2024-08-28T16:32:48Z Rafael S
@1.190.5 2024-09-04T22:11:54Z CCBC Service Account <[email protected]> # release v1.190.5
@1.190.6 2024-09-04T22:32:44Z CCBC Service Account <[email protected]> # release v1.190.6
@1.190.7 2024-09-04T22:50:09Z CCBC Service Account <[email protected]> # release v1.190.7
@1.190.8 2024-09-04T23:08:50Z CCBC Service Account <[email protected]> # release v1.190.8
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CONN-CCBC-portal",
"version": "1.190.7",
"version": "1.190.8",
"main": "index.js",
"repository": "https://github.com/bcgov/CONN-CCBC-portal.git",
"author": "Romer, Meherzad CITZ:EX <[email protected]>",
Expand Down

0 comments on commit 20ca1dc

Please sign in to comment.