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

District teams list: only show teams who've competed that year #5289

Open
wants to merge 8 commits into
base: py3
Choose a base branch
from

Conversation

cjdenio
Copy link
Contributor

@cjdenio cjdenio commented May 26, 2023

Description

The district teams list sometimes includes teams that didn't actually compete in a given year. This seems to be an issue with the FIRST API:
Screenshot 2023-05-26 at 1 59 29 PM

This change filters the list by only showing teams that have competed (or will compete) in an event that year.

Motivation and Context

Fixes #5106!

How Has This Been Tested?

I've verified that after this change, the NE team list matches the one on FIRST's website.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change API specifications or require data migrations)

@@ -94,10 +95,13 @@ def __init__(self, district_key: DistrictKey) -> None:
def _query_async(
self, district_key: DistrictKey
) -> Generator[Any, Any, List[Team]]:
year = int(re.match(r"\d{4,}", district_key).group(0))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming there's some sort of helper for parsing these but I couldn't find one.

@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Merging #5289 (c4572bd) into py3 (d819bee) will decrease coverage by 21.04%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##              py3    #5289       +/-   ##
===========================================
- Coverage   92.25%   71.22%   -21.04%     
===========================================
  Files         640        8      -632     
  Lines       40277      344    -39933     
  Branches       60       60               
===========================================
- Hits        37159      245    -36914     
+ Misses       3110       91     -3019     
  Partials        8        8               

see 632 files with indirect coverage changes

Copy link
Member

@fangeugene fangeugene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this seems good. Though I wonder if filtering on query is the correct thing to do, or if we should be doing more validation on write?

cc @phil-lopreiato thoughts?

Copy link
Member

@fangeugene fangeugene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes! Can you fix the failing tests (and add a test that tests your changes)?

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

Successfully merging this pull request may close these issues.

NE team list includes inactive teams
2 participants