X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ultimate.js;h=358f2fb6634e4383d9222d6de4bb154939fa503a;hb=971d4957bed4eba223b0ace948cfb5f991e0847f;hp=cfcdf2e682772bb0625f6b3dfbe9404271d3f1cf;hpb=fadfb9a0dbb5ecda1fa2cab4ec4192dfd7990723;p=pkanalytics diff --git a/ultimate.js b/ultimate.js index cfcdf2e..358f2fb 100644 --- a/ultimate.js +++ b/ultimate.js @@ -178,7 +178,6 @@ function process_matches(json, filters) { 'stallouts': 0, 'defenses': 0, - 'interceptions': 0, 'points_played': 0, 'playing_time_ms': 0, 'offensive_playing_time_ms': 0, @@ -483,6 +482,16 @@ function process_matches(json, filters) { } } + if (type !== 'out' && type !== 'in' && p !== undefined && p.on_field_since === null) { + console.log('Event “' + type + '” on subbed-out player ' + p.name + ' in ' + our_score + '\u2013' + their_score + ' in ' + match['description']); + } + if (type === 'catch' && handler !== null && players[handler].on_field_since === null) { + // The handler subbed out and was replaced with another handler, + // so this wasn't a pass. + console.log('Pass from subbed-out player ' + players[handler].name + ' in ' + our_score + '\u2013' + their_score + ' in ' + match['description'] + '; ignoring.'); + handler = null; + } + // Event management if (type === 'catch' || type === 'goal') { if (handler !== null) { @@ -528,7 +537,7 @@ function process_matches(json, filters) { if (keep) ++p.defenses; } else if (type === 'interception') { if (keep) { - ++p.interceptions; + ++p.catches; ++p.defenses; ++p.touches; }