Skip to content

Commit

Permalink
Sort the faction detail summary senators (#378)
Browse files Browse the repository at this point in the history
Sort the faction detail summary senators using the same order as the senator list - alphabetic order on the name field. Generation doesn't matter here because the faction detail summary doesn't show dead senators.
  • Loading branch information
iamlogand authored Jan 18, 2024
1 parent 54a2c64 commit ba4c924
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frontend/components/detailSections/DetailSection_Faction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ const FactionDetails = () => {
let senators: Collection<Senator> = new Collection<Senator>([])
if (selectedDetail && selectedDetail.type == "Faction") {
senators = new Collection<Senator>(
allSenators.asArray.filter(
(s) => s.faction === selectedDetail.id && s.alive === true
)
// Filter by faction and alive, then sort by name
allSenators.asArray
.filter((s) => s.faction === selectedDetail.id && s.alive === true)
.sort((a, b) => a.name.localeCompare(b.name))
)
}
const faction: Faction | null = selectedDetail?.id
Expand Down

0 comments on commit ba4c924

Please sign in to comment.