Created
July 30, 2012 01:03
-
-
Save mabster/3203077 to your computer and use it in GitHub Desktop.
Pig Gives Birth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the business logic for the creation of a new litter | |
Find the pig with the given id to make sure it's on the user's farm, female and pregnant. If not, return error. | |
Find the pig's most recent mating, which should be in a gestating state. If not, return error. | |
If it's been less than 100 days or more than 130 days since the mating, return error. | |
Update the mating to a successful state. | |
Update the pig to a lactating state. | |
Create a new birth event. | |
Create a new litter with the given number of piglets and the pig as the mother. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment