Project

General

Profile

Actions

Bug #18

open

Goal.empty_net field not being set correctly

Added by William Lang about 1 month ago.

Status:
Backlog
Priority:
High
Assignee:
-
Start date:
01/17/2026
Due date:
% Done:

0%

Estimated time:

Description

The Goal.empty_net boolean field is not being populated correctly. There are 521 goals where goalie_id is nil (indicating no goalie in net) but empty_net is false.

Current Behavior

  • Goals with goalie_id: nil: 521
  • Goals with empty_net: true: 0

Expected Behavior

Goals without a goalie should have empty_net: true.

Root Cause Investigation

The extraction logic in shot_goal_extraction_service.rb line 270:

empty_net: play.strength.present? ? play.strength == "EN" : play.goalie_in_net_id.nil?

This suggests either:

  1. Older data was extracted before this logic existed
  2. The play.strength field is present but not "EN" in some cases (e.g., power play empty net situations)

Impact

  • Low priority - danger zone generation already excludes empty net shots via .where.not(goalie_id: nil) filter
  • Affects any queries that rely on Goal.empty_net field

Fix Needed

  1. Review the extraction logic to handle edge cases (e.g., PP empty net goals)
  2. Backfill existing goals: Goal.where(goalie_id: nil).update_all(empty_net: true)

No data to display

Actions

Also available in: Atom PDF