feat: add src/report.mjs
This commit is contained in:
8
src/report.mjs
Normal file
8
src/report.mjs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
export function summarize(result) {
|
||||||
|
const outstanding = [], anomalies = [];
|
||||||
|
for (const [key, state] of result.groups) {
|
||||||
|
if (state.open) outstanding.push({ key, since: state.firstAlarm, acknowledged: state.acknowledged });
|
||||||
|
for (const reason of state.anomalies) anomalies.push({ key, reason });
|
||||||
|
}
|
||||||
|
return { outstanding, anomalies, rejected: result.rejected };
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user