battlecode / galaxy

MIT License
10 stars 3 forks source link

Add Win/Loss Record Home Tile #781

Open lowtorola opened 5 months ago

lowtorola commented 5 months ago

Description

We need an API implementation that gets a team's win/loss record for a given episode. Observe the very sad unconnected tile for it in the prod frontend: 😆

Screenshot 2024-04-27 at 7 10 57 PM

Steps to implement

Lowell will add these as a full-stack dev README in galaxy somewhere

  1. [ ] Create a serializer to represent the win/loss record of a team in backend/.../compete/serializers.py
  2. [ ] Create a view in backend/.../compete/views.py that returns a team's win-loss record (make sure to decorate the parameter(s) with OpenApiParameter and to default to the currently logged-in user's team)
  3. [ ] Run frontend2/generate_types.sh to add the types/api function to our frontend autogen api
  4. [ ] Add entries called e.g. winLossHistoryBase, winLossHistoryOther, winLossHistoryMe to competeKeys.ts (use the "ratingHistory" keys as an example
  5. [ ] Add factories for these keys to competeFactories.ts (again use ratingHistory as an example).
  6. [ ] Create hooks for each in useCompete.ts (... as example).
  7. [ ] Prefetch your hook's queryKey/Fn in homeLoader.ts
  8. [ ] Connect the TODO tiles in Home.tsx to your API endpoint by adding the hook in the file
  9. [ ] Success! 🥳
lowtorola commented 5 months ago

Note: Maybe just start with items 1-3 use #780 as a reference then I will go over the rest in hack session 😎