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

Letters in team numbers are converted to numbers #338

Open
William5553 opened this issue Aug 23, 2023 · 1 comment
Open

Letters in team numbers are converted to numbers #338

William5553 opened this issue Aug 23, 2023 · 1 comment

Comments

@William5553
Copy link

William5553 commented Aug 23, 2023

When requesting a match where a team has a letter in it, the API converts the letters in the team to a number representation. An example can be found with 2023mirr, 6081B, 5712B, and 7211B are represented as 608100001, 571200001 and 721100001. On statbotics, the letter representation is shown properly.
This is a breaking change, however, TBA does represent the teams properly and returns frc6081B, frc5712B, and frc7211B.

@avgupta456
Copy link
Owner

Yeah I only started supporting offseason teams recently, and I had already set the column to Integer instead of String. I'm rewriting a lot of it right now and it should be fixed by next season. In the meantime, you can manually convert from one representation to the other. Here's the JavaScript code the frontend uses:

export const formatNumber = (num: number) => {
  if (num > 100000) {
    return round(num / 100000, 0).toString() + String.fromCharCode(65 + (num % 100000));
  }
  return num.toString();
};

https://github.com/avgupta456/statbotics/blob/master/frontend/components/utils.tsx

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