og-statistics 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +2 -5
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -137,7 +137,6 @@ function filterIncidents(incidents) {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
141
140
|
const CARD_CLASSES = ['red', 'yellow', 'yellowRed'];
|
|
142
141
|
|
|
143
142
|
const filterCards = (incidents, isHome) => {
|
|
@@ -189,10 +188,9 @@ function filterSubs(incidents, isHome) {
|
|
|
189
188
|
}
|
|
190
189
|
}
|
|
191
190
|
|
|
192
|
-
|
|
193
191
|
function goalSummary(incidentsData, windowMinutes = 15) {
|
|
194
192
|
try {
|
|
195
|
-
const {
|
|
193
|
+
const { home = [], away = [] } = incidentsData;
|
|
196
194
|
|
|
197
195
|
// Normaliza goles de cada lado
|
|
198
196
|
function extractGoals(events, teamLabel) {
|
|
@@ -206,7 +204,7 @@ function goalSummary(incidentsData, windowMinutes = 15) {
|
|
|
206
204
|
}));
|
|
207
205
|
}
|
|
208
206
|
|
|
209
|
-
const homeGoals = extractGoals(
|
|
207
|
+
const homeGoals = extractGoals(home, 'home');
|
|
210
208
|
const awayGoals = extractGoals(away, 'away');
|
|
211
209
|
const goals = [...homeGoals, ...awayGoals].sort((a, b) => a.time - b.time);
|
|
212
210
|
|
|
@@ -439,5 +437,4 @@ function goalSummary(incidentsData, windowMinutes = 15) {
|
|
|
439
437
|
}
|
|
440
438
|
}
|
|
441
439
|
|
|
442
|
-
|
|
443
440
|
module.exports = { filterStats, filterIncidents, goalSummary };
|