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

Fix default_type_id type in animal uses API #3391

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

SayakaOno
Copy link
Collaborator

Description

  • Fix default_type_id type in animal_uses API to number (it was used as map keys and converted to string)
  • Make the test more strict (I shouldn't have used ==!!!)
  • Adjust frontend code

Jira link: N/A

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain)

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have added "MISSING" for all new language tags to languages I don't speak
  • I have added the GNU General Public License to all new files

@SayakaOno SayakaOno added bug Something isn't working Blocked labels Aug 21, 2024
@SayakaOno SayakaOno self-assigned this Aug 21, 2024
@SayakaOno SayakaOno changed the title [WIP] Fix default_type_id type in animal uses API Fix default_type_id type in animal uses API Aug 26, 2024
@SayakaOno SayakaOno removed the Blocked label Aug 26, 2024
@SayakaOno SayakaOno marked this pull request as ready for review August 26, 2024 20:36
@SayakaOno SayakaOno requested review from a team as code owners August 26, 2024 20:36
@SayakaOno SayakaOno requested review from Duncan-Brain and kathyavini and removed request for a team August 26, 2024 20:36
Copy link
Collaborator

@kathyavini kathyavini left a comment

Choose a reason for hiding this comment

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

Thank you! And it's kind of fun to see a situation in the wild where == vs === makes the difference!

I guess a +1 to TS on the backend too 🙂

@@ -57,7 +57,7 @@ class AnimalUse extends baseModel {
}, {});

const response = Object.entries(usesPerType).map(([defaultTypeId, uses]) => {
return { default_type_id: defaultTypeId, uses };
return { default_type_id: +defaultTypeId, uses };
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does fix the typing, but I am not sure about all the manipulation to format the data before it gets to the frontend that seems to be the root issue.

I might look deeper tomorrow but this is a strange endpoint...

Copy link
Collaborator

@Duncan-Brain Duncan-Brain left a comment

Choose a reason for hiding this comment

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

Works well!

@Duncan-Brain Duncan-Brain added this pull request to the merge queue Aug 29, 2024
Merged via the queue into integration with commit 1ae1204 Aug 29, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants