Skip to content

Commit

Permalink
13/14 new if block, female test failing
Browse files Browse the repository at this point in the history
  • Loading branch information
blackqueentech committed May 24, 2022
1 parent 19a1686 commit b3ef630
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions contracts/PetPark.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,17 @@ contract PetPark {
revert("Invalid Gender");
}

if (u.age != 0 && u.age == _age) {
if (u.gender == _gender) {
if (u.animal != AnimalType.None) {
revert("Already adopted a pet");
}
}
}

u.age = _age;
u.gender = _gender;

require(u.animal == AnimalType.None, "Already adopted a pet");

if (u.gender == Gender.Female && u.age < 40) {
if (_animal == AnimalType.Cat) {
revert("Invalid animal for women under 40");
Expand Down

1 comment on commit b3ef630

@codingnirvana
Copy link
Contributor

Choose a reason for hiding this comment

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

This was the if block I was talking about

if (u.age != 0) {
      
      if (u.age != _age) {
          revert("Invalid Age");
      }

      if (u.gender != _gender) {
          revert("Invalid Gender");
      }

      require(u.animal == AnimalType.None, "Already adopted a pet");
  }

Please sign in to comment.