Skip to content

Inconsistent "conference" properties for advanced stats #272

@cbortz

Description

@cbortz

Summary

When requesting advanced stats, the "conference" property always displays the current conference. The regular stats endpoint, however, returns the relevant conference for each stat.

Steps to reproduce

  1. Make a request for advanced stats for a team that has changed conferences, for example UCF.

    • without a year parameter
      curl \
          --request GET 'https://api.collegefootballdata.com/stats/season/advanced?team=ucf' \
          --header 'Authorization: Bearer $CFBD_API_TOKEN'
    • with a year parameter
      curl \
          --request GET 'https://api.collegefootballdata.com/stats/season/advanced?team=ucf&year=2005' \
          --header 'Authorization: Bearer $CFBD_API_TOKEN'
  2. Inspect a stat for a year where they were in a different conference (e.g. 2005)

    {
         "season": 2005,
         "team": "UCF",
         "conference": "American Athletic",
         ...
    }

Expected results

The "conference" property is the conference affiliated with the team at the time of the stat (e.g. "Conference USA").

Actual results

The "conference" property is always the current conference (e.g. "American Athletic").

Other notes

The StatsService.getTeamStats function builds the SQL that joins on the matching conference, which I think is desired:

INNER JOIN conference_team AS ct
  ON t.id = ct.team_id
  AND ct.start_year <= g.season
  AND (ct.end_year IS NULL OR ct.end_year >= g.season)

The StatsService.getAdvancedStats function builds the SQL using a couple different join conditions, but always on the latest conference:

INNER JOIN conference_team AS ct
  ON t.id = ct.team_id
  AND ct.end_year IS NULL

and...

INNER JOIN conference_team AS ct
  ON ct.team_id = t.id
  AND ct.end_year IS NULL
  AND ct.start_year IS NOT NULL

Thoughts @BlueSCar ?

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