Admin for crop job templates, a tidier crop wrangling page, and crop and template seeds
2.1 KiB
The format for these crop seed files is CSV, with no header row, and the fields:
Crop name English Wikipedia URL Parent crop name (optional; the parent must be in an earlier row or file) Scientific name (optional; taken from the parent if left out)
Files are loaded in name order by rake db:seed (see load_crops in db/seeds.rb),
and loading one again just updates the crops that are already there.
crops-20-growstuff-org.csv is the set of crops on https://www.growstuff.org, from
https://www.growstuff.org/crops.csv, with parents ahead of their children.
Crop job templates
crop_job_templates/*.json has a crop's suggested jobs, one file per crop. They are
added by rake db:seed, or on their own by rake growstuff:import_crop_job_templates
(with file=path.json for just one). Templates are only ever added: one already there,
by crop and name, is left alone, so a crop wrangler's changes survive seeding again.
Templates are written as draft, for a crop wrangler to check and publish.
{
"crop": "tomato",
"templates": [
{
"name": "Growing tomatoes",
"applies_to": "cherry tomato",
"season": "any",
"status": "draft",
"steps": [
{"name": "Sow seeds indoors", "amount": 6, "unit": "weeks", "direction": "before", "anchor": "planting_out", "repeat": "once"}
]
}
]
}
crop: the crop's name. A crop that isn't in the database is skipped.applies_to(optional): the name of one of that crop's varieties, for a template that is only for it.season:any,spring_summerorautumn_winter.status:draftorpublished.- A step's
unitisdays,weeksormonths;directionisbeforeorafter;anchorissowing,planting_outorfirst_harvest;repeatisonce,weekly,fortnightlyormonthly. Leave out what you don't need:amountis 0,unitweeks,directionafter,anchorplanting_out andrepeatonce. A step can also have anexternal_uri: a web address (starting withhttp://orhttps://) with more on how to do it. - Steps keep the order written.