Skip to content

Instantly share code, notes, and snippets.

@wsmoak
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wsmoak/679c25268d21fcb8a13a to your computer and use it in GitHub Desktop.
Save wsmoak/679c25268d21fcb8a13a to your computer and use it in GitHub Desktop.
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