GithubHelp home page GithubHelp logo

sportstandingsscores's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

simplysynced

sportstandingsscores's Issues

Cannot read properties of undefined (reading 'find')

First I will admit I have no idea what I am doing. I am trying to add just a simple NFL standings card

I followed what you have and added in the config:

Then I followed what you have for the NFL standings card:

type: custom:flex-table-card
title: NFL Standings
sort_by: entries-
entities:
include: sensor.nfl_standings
columns:

  • hidden: true
    data: entries
    modify: x.stats.find(y=>y.abbreviation == 'PCT').value.toFixed(2)
  • name: C
    data: entries
    modify: >-
    if(typeof x.stats.find(y=>y.abbreviation == 'CLINCH') !== 'undefined'
    ){x.stats.find(y=>y.abbreviation == 'CLINCH').displayValue}else{'-'}
  • name: Team
    data: entries
    modify: >-
    '
    ย ' + x.team.displayName + '
    '
  • name: GP
    data: entries
    modify: >-
    x.stats.find(y=>y.abbreviation == 'L').value +
    x.stats.find(y=>y.abbreviation == 'W').value +
    x.stats.find(y=>y.abbreviation == 'T').value
  • name: W
    data: entries
    modify: x.stats.find(y=>y["abbreviation"] == 'W').value
  • name: L
    data: entries
    modify: x.stats.find(y=>y.abbreviation == 'L').value
  • name: T
    data: entries
    modify: x.stats.find(y=>y.abbreviation == 'T').value
  • name: PCT
    data: entries
    modify: x.stats.find(y=>y.abbreviation == 'PCT').value.toFixed(2)
  • name: HOME
    data: entries
    modify: x.stats.find(y=>y.shortDisplayName == 'HOME').displayValue
  • name: AWAY
    data: entries
    modify: x.stats.find(y=>y.shortDisplayName == 'AWAY').displayValue
  • name: DIV
    data: entries
    modify: x.stats.find(y=>y.shortDisplayName == 'DIV').displayValue
  • name: CONF
    data: entries
    modify: x.stats.find(y=>y.shortDisplayName == 'CONF').displayValue
  • name: PF
    data: entries
    modify: x.stats.find(y=>y.shortDisplayName == 'PF').displayValue
  • name: PA
    data: entries
    modify: x.stats.find(y=>y.shortDisplayName == 'PA').displayValue
  • name: DIFF
    data: entries
    modify: x.stats.find(y=>y.shortDisplayName == 'DIFF').displayValue
  • name: STRK
    data: entries
    modify: x.stats.find(y=>y.shortDisplayName == 'STRK').displayValue

But I keep getting the error "Cannot read properties of undefined (reading 'find')"

Amazing Work

Just wanted to say this is truly amazing work! Great job. Is there a better way to contact you?

NHL Stats off because some teams have clincher field

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.

        - name: C
          data: entries
          modify: if(typeof x.stats.find(y=>y.abbreviation == 'CLINCH') !== 'undefined' ){x.stats.find(y=>y.abbreviation == 'CLINCH').displayValue}else{'-'}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.