Improve seeds.rb to use correct openfarm_slug

pull/1073/head
Rick Carlino 2018-12-27 10:33:09 -06:00
parent c72bec8435
commit 549dfb5870
2 changed files with 6 additions and 4 deletions

View File

@ -52,12 +52,13 @@ if Rails.env == "development"
end end
PLANT_COUNT.times do PLANT_COUNT.times do
veggie = Faker::Food.vegetables
Plant.create(device: u.device, Plant.create(device: u.device,
x: rand(40...970), x: rand(40...970),
y: rand(40...470), y: rand(40...470),
radius: rand(10...50), radius: rand(10...50),
name: Faker::Food.vegetables, name: veggie,
openfarm_slug: ["tomato", "carrot", "radish", "garlic"].sample) openfarm_slug: veggie.downcase.gsub(" ", "-"))
end end
Device.all.map { |device| SavedGardens::Snapshot.run!(device: device) } Device.all.map { |device| SavedGardens::Snapshot.run!(device: device) }

View File

@ -173,7 +173,8 @@ export class EditFEForm extends React.Component<EditFEProps, State> {
(declaration: VariableDeclaration) => { (declaration: VariableDeclaration) => {
const body = addOrEditVarDeclaration(declarations, declaration); const body = addOrEditVarDeclaration(declarations, declaration);
const state = { fe: { body }, specialStatusLocal: SpecialStatus.DIRTY }; const state = { fe: { body }, specialStatusLocal: SpecialStatus.DIRTY };
this.setState(betterMerge(this.state, state)); const result = betterMerge(this.state, state);
this.setState(result);
} }
LocalsList = () => <LocalsList LocalsList = () => <LocalsList
@ -305,7 +306,7 @@ export class EditFEForm extends React.Component<EditFEProps, State> {
t("Unable to save farm event.")); t("Unable to save farm event."));
return; return;
} }
// debugger;
this.dispatch(overwrite(this.props.farmEvent, updatedFarmEvent)); this.dispatch(overwrite(this.props.farmEvent, updatedFarmEvent));
const EditFEPath = window.location.pathname; const EditFEPath = window.location.pathname;
this this