Skip to content

Null Player Returned For Teams starting in Year: 2020 #329

@CN120

Description

@CN120

Starting in year: 2020 and continuing through latest roster year (2024), when querying the roster endpoint, seemingly for all teams, the first RosterPlayer result looks something like this

{
    "id": "-6635",
    "firstName": "",
    "lastName": "",
    "team": "Michigan",
    "weight": null,
    "height": null,
    "jersey": null,
    "year": 2020,
    "position": null,
    "homeCity": null,
    "homeState": null,
    "homeCountry": null,
    "homeLatitude": null,
    "homeLongitude": null,
    "homeCountyFIPS": null,
    "recruitIds": []
  },

where all fields are null/empty besides id, team, and year. Though this has an ID, it seemingly it is some sort of garbage data that should not be in the database.

Besides this being garbage data, there is also a secondary problem, which is that the year property in the response is determined in the code like this: year: r.year ?? year,. This null coalescing expression, combines different concepts that happen to share the same name. In this context, r.year represents the year a player is in school, i.e. some single digit integer representing freshman through nth year senior, where as just year represents the calendar year the roster is being requested for. It doesn't make sense to fall back to the calendar year if the player.year is null. Instead, it should be something like 0 or null to communicate that it is unknown. As to not have to change the nullability of that field in the API, I would personally go with year: r.year ?? 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions