Skip to content

Commit

Permalink
adjust mock data
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Jun 6, 2024
1 parent 454ce96 commit d2aed30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions editor.planx.uk/src/@planx/components/List/Public/Context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,14 @@ export const ListProvider: React.FC<ListProviderProps> = (props) => {
// basic example of general summary stats we can add onSubmit
let sumIdenticalUnits = 0;
defaultPassportData[`${props.fn}`].map(
(item) => (sumIdenticalUnits += parseInt(item.identicalUnits)),
(item) => (sumIdenticalUnits += parseInt(item?.identicalUnits)),
);
const summaries = {
[`${props.fn}.total.listItems`]:
defaultPassportData[`${props.fn}`].length,
[`${props.fn}.total.units`]: sumIdenticalUnits,
...(sumIdenticalUnits > 0 && {
[`${props.fn}.total.units`]: sumIdenticalUnits,
}),
};

handleSubmit?.({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const mockPayload = {
"mockFn.two.email": "[email protected]",
"mockFn.two.name": "Richard Parker",
"mockFn.two.size": "Medium",
"mockFn.count": 2,
"mockFn.total.listItems": 2,
},
};

Expand Down

0 comments on commit d2aed30

Please sign in to comment.