avgupta456 / statbotics

📈 Modernizing Data Analytics for FRC Robotics
https://statbotics.io/
MIT License
64 stars 9 forks source link

Letters in team numbers are converted to numbers #338

Open William5553 opened 10 months ago

William5553 commented 10 months ago

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 commented 10 months ago

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