Skip to content

Commit

Permalink
satisfy all export cases
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamAdHocTeam committed Oct 29, 2024
1 parent 90eca01 commit b71995f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions frontend/src/hooks/useWidgetExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@ export default function useWidgetExport(
// If the ID isn't a number, keep it as a string.
const selectedRowsIds = selectedRowsStrings.map((s) => {
const parsedInt = parseInt(s, DECIMAL_BASE);
return Number.isNaN(parsedInt) ? s : parsedInt;
return s.includes('-') ? s : parsedInt;
});
// Filter the recipients to export to only include the selected rows.
dataToExport = data.filter((row) => {
let rowId = row.id;
if (typeof rowId === 'string') {
const splitId = rowId.split('-');
rowId = parseInt(splitId[0], DECIMAL_BASE);
}
return selectedRowsIds.includes(rowId);
});
dataToExport = data.filter((row) => selectedRowsIds.includes(row.id));
}

// Create a header row.
Expand Down

0 comments on commit b71995f

Please sign in to comment.