Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent "conference" properties for advanced stats #272

Open
cbortz opened this issue Nov 23, 2022 · 1 comment
Open

Inconsistent "conference" properties for advanced stats #272

cbortz opened this issue Nov 23, 2022 · 1 comment

Comments

@cbortz
Copy link
Contributor

cbortz commented Nov 23, 2022

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 ?

@BlueSCar
Copy link
Collaborator

I agree that getAdvancedStats should display conference data as it pertains to the requested year as this is consistent with getTeamStats and virtually every other API endpoint. The fact that it doesn't currently function in this way is certainly an oversight and should be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants