26 lines
782 B
JavaScript
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
|
|
};
|
|
}
|