Files
pedwfrontend/lib/domain/dashboard-policy/splitWatchedCasesBySubmissionState.js
T
2026-06-17 16:06:09 +00:00

26 lines
782 B
JavaScript

/**
* This helper owns watched-case classification by representation submission state.
*
* It intentionally preserves loose-null semantics because existing dashboard
* behaviour treats both null and undefined as "not submitted".
*/
export function splitWatchedCasesBySubmissionState(records = []) {
const watchedCases = {
"@odata.count": records.filter(
(record) => record.pinswg_representationsubmitted == null
).length,
value: records.filter(
(record) => record.pinswg_representationsubmitted == null
)
};
const submittedRepresentations = records.filter(
(record) => record.pinswg_representationsubmitted != null
);
return {
watchedCases,
submittedRepresentations
};
}