Skip to content

Commit

Permalink
Fix storage value
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc committed Dec 18, 2024
1 parent 9a267f8 commit 0a67e76
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,12 @@ export function getSubjectField(): IFieldDefinition {
return (item.subject ?? []).map(({qcode}) => qcode);
},
storeValue: (item, operationalValue: Array<ISubjectCode['qcode']>) => {
interface IStorageFormat {
qcode: string;
name: string;
parent?: string;
}

const allSubjects: Array<ISubjectCode> = (planningApi.redux.store.getState().subjects ?? [])
.filter((x) => operationalValue.includes(x.qcode));

return {
...item,
subject: allSubjects.map(({qcode, name, parent}) => {
var itemToStore: IStorageFormat = {qcode, name, parent};

if (parent != null) {
itemToStore.parent = parent;
}

return itemToStore;
}),
subject: allSubjects,
};
},
}
Expand Down

0 comments on commit 0a67e76

Please sign in to comment.