Skip to content

Commit

Permalink
Bug fix: Mounted tools caused runtime error in Device::Reset
Browse files Browse the repository at this point in the history
  • Loading branch information
RickCarlino committed Oct 26, 2020
1 parent d1228db commit 67e05cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/mutations/devices/reset.rb
Expand Up @@ -20,7 +20,7 @@ def execute

def run_it
ActiveRecord::Base.transaction do
device.update!(name: "FarmBot")
device.update!(name: "FarmBot", mounted_tool_id: nil)
Device::SINGULAR_RESOURCES.keys.map do |resource|
device.send(resource).destroy!
end
Expand Down
7 changes: 5 additions & 2 deletions db/structure.sql
Expand Up @@ -467,7 +467,9 @@ CREATE TABLE public.fbos_configs (
firmware_path character varying,
firmware_debug_log boolean DEFAULT false,
update_channel character varying(7) DEFAULT 'stable'::character varying,
boot_sequence_id integer
boot_sequence_id integer,
safe_height integer DEFAULT 0,
soil_height integer DEFAULT 0
);


Expand Down Expand Up @@ -3454,6 +3456,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200823211337'),
('20200902141446'),
('20200907153510'),
('20200910175338');
('20200910175338'),
('20200914165414');


Expand Up @@ -22,7 +22,8 @@
expect(device.send(resource.pluralize).reload.count).to be > 0
end

device.update(name: "#{SecureRandom.hex(10)}")
device.update!(name: "#{SecureRandom.hex(10)}",
mounted_tool_id: device.tools.first.id)

run_jobs_now { post :reset, body: { password: password }.to_json }

Expand Down

0 comments on commit 67e05cc

Please sign in to comment.