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

0 comments on commit b3ef630

Please sign in to comment.