Merged PR 2395: helpers for dashboard domain layer

Related work items: #23754
This commit is contained in:
Robert Bond
2026-06-17 16:06:09 +00:00
parent 0b66a0e1d4
commit 475aa965b4
11 changed files with 1375 additions and 77 deletions
@@ -0,0 +1,25 @@
/**
* 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
};
}