Merged PR 2395: helpers for dashboard domain layer
Related work items: #23754
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user