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

Scrimmaging Record API Improvements #848

Open
11 tasks
lowtorola opened this issue Nov 9, 2024 · 1 comment
Open
11 tasks

Scrimmaging Record API Improvements #848

lowtorola opened this issue Nov 9, 2024 · 1 comment
Assignees
Labels
module: backend Related to the Siarnaq backend module priority: p1 critical type: bug Something isn't working type: refactor Codebase refactors or structure changes

Comments

@lowtorola
Copy link
Contributor

lowtorola commented Nov 9, 2024

After creating a new Battlecode 2025 episode, it appears that the Scrimmaging Record API has an internal error. As the endpoint already needed a refactor, now is a great time to dig into the endpoint and make sure it is ready for the new frontend release. There are two tasks for this issue, which are each explained in detail below... please reach out with any questions as this will be a big task.

  • Scrimmaging record API bug fix
    • Open the frontend. An error toast should pop up on your home screen 😨
    • Navigate to your terminal that is running your backend. Find the network request which is returning status 500 (example below)
    • Read the error output to find the path to the file that is generating the error! Take a glance around, maybe throw the file into an AI assistant to have it explain what the file is for and how it fits into a Django API. You should probably stop here and have a senior Webinfra dev explain how teh Django works (roughly)
    • Fix the bug! I think it should be pretty easy
  • Scrimmaging record API refactor
    • Currently, the API schema has separate endpoints for RANKED/UNRANKED/ALL. This is implemented as an OpenAPI Parameter (I believe? I could be wrong tbh). We would like to refactor this so that this is back under one endpoint, with W/L/T counts for each type of match. A before and after of the schemas is below.
    • Once you have implemented the new schema, you will need to run generate_types.sh to update our auto-generated API
    • After updating our types, you should fix the frontend API functions that will inevitably have many errors. NOTE: here you should probably stop and meet/hop on a zoom with me (Lowell) to discuss wtf a query factory/key/function is and how it will be impacted by this change 😄
    • Now, fix the frontend errors and make use of your glorious singular endpoint 🥳
    • Now, ask serena or Lowell for help with creating a breaking API release, and you're done!

Current schema:

compete/scrimmaging_record/
│
├── Ranked/
│   ├── wins:   ████ 42
│   ├── losses: ████ 18
│   └── ties:   ████ 5
│
├── Unranked/
│   ├── wins:   ████ 30
│   ├── losses: ████ 12
│   └── ties:   ████ 3
│
└── All/
    ├── wins:   ████ 72
    ├── losses: ████ 30
    └── ties:   ████ 8

New (desired) Schema:

compete/scrimmaging_record
│
└── {
    "Ranked": {
        "wins":   ████ 42
        "losses": ████ 18
        "ties":   ████ 5
    },
    "Unranked": {
        "wins":   ████ 30
        "losses": ████ 12
        "ties":   ████ 3
    },
    "All": {
        "wins":   ████ 72
        "losses": ████ 30
        "ties":   ████ 8
    }
}

Example of the server error in the log (note the trace 😃):
image

@lowtorola lowtorola added type: bug Something isn't working priority: p1 critical module: backend Related to the Siarnaq backend module type: refactor Codebase refactors or structure changes labels Nov 9, 2024
@lowtorola lowtorola added this to the Frontend2 Alpha milestone Nov 9, 2024
@lowtorola
Copy link
Contributor Author

@beshrislambouli Instructions are all updated! Please reach out to the slack or a specific person (me/nour) with any questions you have or with help getting started with any of the numerous code sections you'll be nuking 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: backend Related to the Siarnaq backend module priority: p1 critical type: bug Something isn't working type: refactor Codebase refactors or structure changes
Projects
None yet
Development

No branches or pull requests

2 participants