@@ -112,26 +112,26 @@ async function fetchOrgAnalyticsData (time: string, spinner: Ora, apiKey: string
112
112
113
113
spinner . stop ( )
114
114
115
- const data = result . data . reduce ( ( acc : { [ key : string ] : any } , current ) => {
116
- const formattedDate = new Date ( current . created_at ) . toLocaleDateString ( )
117
-
118
- if ( acc [ formattedDate ] ) {
119
- acc [ formattedDate ] . total_critical_alerts += current . total_critical_alerts
120
- acc [ formattedDate ] . total_high_alerts += current . total_high_alerts
121
- acc [ formattedDate ] . total_critical_added += current . total_critical_added
122
- acc [ formattedDate ] . total_high_added += current . total_high_added
123
- acc [ formattedDate ] . total_critical_prevented += current . total_critical_prevented
124
- acc [ formattedDate ] . total_high_prevented += current . total_high_prevented
125
- acc [ formattedDate ] . total_medium_prevented += current . total_medium_prevented
126
- acc [ formattedDate ] . total_low_prevented += current . total_low_prevented
127
- // acc[formattedDate].top_five_alert_types += current.top_five_alert_types
128
- } else {
129
- acc [ formattedDate ] = current
130
- acc [ formattedDate ] . created_at = formattedDate
131
- }
132
-
133
- return acc
134
- } , { } )
115
+ // const data = result.data.reduce((acc: { [key: string]: any }, current) => {
116
+ // const formattedDate = new Date(current.created_at).toLocaleDateString()
117
+
118
+ // if (acc[formattedDate]) {
119
+ // acc[formattedDate].total_critical_alerts += current.total_critical_alerts
120
+ // acc[formattedDate].total_high_alerts += current.total_high_alerts
121
+ // acc[formattedDate].total_critical_added += current.total_critical_added
122
+ // acc[formattedDate].total_high_added += current.total_high_added
123
+ // acc[formattedDate].total_critical_prevented += current.total_critical_prevented
124
+ // acc[formattedDate].total_high_prevented += current.total_high_prevented
125
+ // acc[formattedDate].total_medium_prevented += current.total_medium_prevented
126
+ // acc[formattedDate].total_low_prevented += current.total_low_prevented
127
+ // // acc[formattedDate].top_five_alert_types += current.top_five_alert_types
128
+ // } else {
129
+ // acc[formattedDate] = current
130
+ // acc[formattedDate].created_at = formattedDate
131
+ // }
132
+
133
+ // return acc
134
+ // }, {})
135
135
136
136
// console.log(data)
137
137
0 commit comments