Last active
August 29, 2015 14:08
-
-
Save wsmoak/679c25268d21fcb8a13a to your computer and use it in GitHub Desktop.
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
coll.insert ({"type"=>"breeding", "doe"=>"C3", "buck"=>"C4", "date"=>to_utc(2014,11,7), | |
"exposures" => [ | |
{"type"=>"exposure", "date" => to_utc(2014,11,7), "notes"=>"not interested"}, | |
{"type"=>"exposure", "date" => to_utc(2014,11,8), "notes"=>"success"} | |
] } | |
) | |
coll.insert({"type"=>"breeding", "doe"=>"NZW8", "buck"=>"C4", "date"=>to_utc(2014,11,7), | |
"exposures" => [ | |
{"type"=>"exposure", "date" => to_utc(2014,11,7), "notes"=>"success"}, | |
{"type"=>"exposure", "date" =>to_utc(2014,11,8), "notes"=>"very upset!"} | |
] } | |
) | |
get '/schedule' do | |
response = '' | |
coll.find("type" => "breeding").each { |breeding| | |
breeding_date = breeding["date"] | |
# last_exposure = # need the max date from the array of exposures | |
response = response + "Doe "+x["doe"]+" Bred on " + breeding_date.strftime("%m/%d" ) + | |
", Add nestbox on " + add_nestbox(breeding_date).strftime("%a %m/%d" ) + | |
", Remove nestbox on " + remove_nestbox(last_exposure).strftime("%a %m/%d") + "<br>" | |
} | |
response | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment