og-statistics 3.0.0 → 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 +6 -7
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -117,16 +117,18 @@ function filterIncidents(incidents) {
|
|
|
117
117
|
|
|
118
118
|
return {
|
|
119
119
|
home: {
|
|
120
|
-
all: home,
|
|
121
120
|
cards: home_cards,
|
|
122
121
|
goals: home_goals,
|
|
123
122
|
subs: home_subs
|
|
124
123
|
},
|
|
125
124
|
away: {
|
|
126
|
-
all: away,
|
|
127
125
|
cards: away_cards,
|
|
128
126
|
goals: away_goals,
|
|
129
127
|
subs: away_subs
|
|
128
|
+
},
|
|
129
|
+
full:{
|
|
130
|
+
home: home,
|
|
131
|
+
away: away
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
134
|
|
|
@@ -135,7 +137,6 @@ function filterIncidents(incidents) {
|
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
|
|
139
140
|
const CARD_CLASSES = ['red', 'yellow', 'yellowRed'];
|
|
140
141
|
|
|
141
142
|
const filterCards = (incidents, isHome) => {
|
|
@@ -187,10 +188,9 @@ function filterSubs(incidents, isHome) {
|
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
|
|
190
|
-
|
|
191
191
|
function goalSummary(incidentsData, windowMinutes = 15) {
|
|
192
192
|
try {
|
|
193
|
-
const {
|
|
193
|
+
const { home = [], away = [] } = incidentsData;
|
|
194
194
|
|
|
195
195
|
// Normaliza goles de cada lado
|
|
196
196
|
function extractGoals(events, teamLabel) {
|
|
@@ -204,7 +204,7 @@ function goalSummary(incidentsData, windowMinutes = 15) {
|
|
|
204
204
|
}));
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
const homeGoals = extractGoals(
|
|
207
|
+
const homeGoals = extractGoals(home, 'home');
|
|
208
208
|
const awayGoals = extractGoals(away, 'away');
|
|
209
209
|
const goals = [...homeGoals, ...awayGoals].sort((a, b) => a.time - b.time);
|
|
210
210
|
|
|
@@ -437,5 +437,4 @@ function goalSummary(incidentsData, windowMinutes = 15) {
|
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
-
|
|
441
440
|
module.exports = { filterStats, filterIncidents, goalSummary };
|