ESPN stats started returning "CLINCHER" object in JSON, but only for those teams who have clinched.
This screwed up indexing the fields.
Two solutions implemented for this for NHL only now, will implement the change in other sports.
First, the proper way to grab a field is by "abbreviation" and not positional index.
This assumes that ESPN will not change the abbreviation for particular stats (doubtful).
This is done using .find. FOr example for the attribute Games Played (GP):
- name: GP
data: entries
modify: x.stats.find(y=>y.abbreviation == 'GP').displayValue
The second was to handle when an object does not exist without error in the flex-table.
This only occurs for CLINCH I would think. it could be made as a generic change across all attributes, but implemented now for only CLINCH.
ESPN stats started returning "CLINCHER" object in JSON, but only for those teams who have clinched. This screwed up indexing the fields.
Two solutions implemented for this for NHL only now, will implement the change in other sports.
First, the proper way to grab a field is by "abbreviation" and not positional index. This assumes that ESPN will not change the abbreviation for particular stats (doubtful). This is done using .find. FOr example for the attribute Games Played (GP):
The second was to handle when an object does not exist without error in the flex-table. This only occurs for CLINCH I would think. it could be made as a generic change across all attributes, but implemented now for only CLINCH.