Skip to content

Conversation

@pantoja
Copy link
Owner

@pantoja pantoja commented May 20, 2020

Description

Refactored Create Battle page using React.

  • Refactored the endpoints involved (battle creation, pokemon listing a user listing)

  • Used react-bootstrap-typeahead to render input field with typeahead

  • Used react-sortable-hoc to allow user to sort pokemon by using drag and drop

Trello Card

As a Programmer I refactor the battle creation page to React

Screenshots (if appropriate):

image

Steps to reproduce (if appropriate):

Link: https://staging-pantoja-pokebattle.herokuapp.com/
Credentials: username: admin@admin.com password: senhaadmin or you can register

  1. Create a battle in the site
  2. Check if battle is created by accessing the Active Battles page. Make sure the informations are right, including the order of the chosen pokemon
  3. Try creating another battle with repeated pokemon, or a battle using Mewtwo in your team to exceed the point limit, it should raise an error

Comment on lines 26 to 27
return queryset.annotate(num_teams=Count("teams")).filter(num_teams=2)
return queryset.annotate(num_teams=Count("teams")).filter(num_teams=1)
Copy link
Collaborator

@victorfsf victorfsf May 26, 2020

Choose a reason for hiding this comment

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

This annotate could be part of the queryset above, before the if. There's less repetition this way.

@victorfsf
Copy link
Collaborator

I was able to create a battle with two of the same pokemon:

image

The warning Your team has duplicates, please use unique pokemon raises if I have 3 repeated pokemon, but not 2.

Other than that, LGTM!

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

Successfully merging this pull request may close these issues.

3 participants