Skip to content

Commit

Permalink
adding the advisory/cycle number into the sort, also reversing sort o…
Browse files Browse the repository at this point in the history
…rder so latest runs are at the top
  • Loading branch information
PhillipsOwen committed Oct 8, 2024
1 parent 8b0ad2d commit 7367dc1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/trays/model-selection/catalogItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ export default function CatalogItems(data) {
}
// return all the data cards
else {
// get the sorting parameter
const sortParam = (data.isTropical) ? 'advisory_number' : 'cycle';

// render the results of the data query
return (
<Fragment>
Expand All @@ -172,7 +175,7 @@ export default function CatalogItems(data) {
// filter by the group name, get the top 1
.filter((val, idx, self) =>
( idx === self.findIndex((t)=> ( t['group'] === val['group']) )))
.sort((a, b) => a.properties['product_name'] < b.properties['product_name'] ? -1 : 1)
.sort((a, b) => a.properties['product_name'] + a.properties[sortParam] < b.properties['product_name'] + b.properties[sortParam] ? 1 : -1)
// output summarized details of each group member
.map((mbr, mbrIdx) => (
// create the checkbox
Expand Down

0 comments on commit 7367dc1

Please sign in to comment.