Skip to content

Commit

Permalink
refactor: [#385] simplify logic for isEligibleToBreed
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Jan 28, 2023
1 parent 789e3c3 commit 560385c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/components/CowCard/Subheader/Subheader.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ const Subheader = ({

const mateId = cowBreedingPen.cowId1 ?? cowBreedingPen.cowId2
const mate = getCowMapById(cowInventory)[mateId]
const isEligibleToBreed = cow.gender !== mate?.gender

const isEligibleToBreed =
(!mate || cow.gender !== mate.gender) && !isThisCowOfferedForTrade

const canBeMovedToBreedingPen = isRoomInBreedingPen && isEligibleToBreed
const canBeMovedToBreedingPen =
isRoomInBreedingPen && isEligibleToBreed && !isThisCowOfferedForTrade

const disableBreedingControlTooltip =
!canBeMovedToBreedingPen && !isInBreedingPen
Expand Down

0 comments on commit 560385c

Please sign in to comment.