Skip to content

Commit

Permalink
Merge pull request #2392 from FarmBot/staging
Browse files Browse the repository at this point in the history
v15.4.13
  • Loading branch information
gabrielburnworth authored Nov 17, 2022
2 parents b0e32af + 4b82564 commit 8138a5c
Show file tree
Hide file tree
Showing 88 changed files with 770 additions and 269 deletions.
36 changes: 18 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ GEM
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
faker (2.23.0)
faker (3.0.0)
i18n (>= 1.8.11, < 2)
faraday (1.10.2)
faraday-em_http (~> 1.0)
Expand Down Expand Up @@ -156,8 +156,8 @@ GEM
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-iamcredentials_v1 (0.15.0)
google-apis-core (>= 0.9.0, < 2.a)
google-apis-iamcredentials_v1 (0.16.0)
google-apis-core (>= 0.9.1, < 2.a)
google-apis-storage_v1 (0.19.0)
google-apis-core (>= 0.9.0, < 2.a)
google-cloud-core (1.6.0)
Expand All @@ -166,7 +166,7 @@ GEM
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.0)
google-cloud-storage (1.43.0)
google-cloud-storage (1.44.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
Expand Down Expand Up @@ -294,18 +294,18 @@ GEM
retriable (3.1.2)
rexml (3.2.5)
rollbar (3.3.2)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.1)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.1)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (~> 3.12.0)
rspec-rails (6.0.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
Expand All @@ -314,14 +314,14 @@ GEM
rspec-expectations (~> 3.11)
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.11.1)
rspec-support (3.12.0)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
ruby2_keywords (0.0.5)
scenic (1.6.0)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
secure_headers (6.4.0)
secure_headers (6.5.0)
set (1.0.3)
signet (0.17.0)
addressable (~> 2.8)
Expand Down Expand Up @@ -360,7 +360,7 @@ GEM
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.1)
zeitwerk (2.6.4)

PLATFORMS
x86_64-linux
Expand Down Expand Up @@ -410,4 +410,4 @@ RUBY VERSION
ruby 3.0.4p208

BUNDLED WITH
2.3.19
2.3.25
1 change: 1 addition & 0 deletions app/models/celery_script_settings_bag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def self.v(symbol)
pointer_type: { defn: [e(:PointType)] },
priority: { defn: [v(:integer)] },
radius: { defn: [v(:integer)] },
depth: { defn: [v(:integer)] },
resource_id: { defn: [v(:integer)] },
resource_type: { defn: [e(:resource_type)] },
resource: { defn: [n(:identifier), n(:resource), n(:point)] },
Expand Down
4 changes: 2 additions & 2 deletions app/models/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ def help_customer
Rollbar.error("Someone is creating a debug user token", { device: self.id })
t = SessionToken.as_json(users.first, "staff", fbos_version)
jti = t[:token].unencoded[:jti]
# Auto expire after 36 hours.
TokenIssuance.find_by!(jti: jti).update!(exp: (Time.now + 36.hours).to_i)
# Auto expire after 1 week.
TokenIssuance.find_by!(jti: jti).update!(exp: (Time.now + 168.hours).to_i)
return "localStorage['session'] = JSON.stringify(#{t.to_json});"
end

Expand Down
1 change: 1 addition & 0 deletions app/models/plant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Plant < Point
planted_at
pointer_type
radius
depth
x
y
z)
Expand Down
17 changes: 0 additions & 17 deletions app/mutations/devices/seeders/demo_account_seeder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,6 @@ def misc
DEMO_LOGS
.map { |p| p.merge(device: device) }
.map { |p| Logs::Create.run!(p) }
25.times do |n|
up = n * 60 * 60
p = {
device: device,
soc_temp: 40,
throttled: "0x0",
wifi_level_percent: 80 + rand(-8...8),
uptime: up,
memory_usage: 50 + rand(-5...5),
disk_usage: 1,
cpu_usage: 5 + rand(-4...4),
target: "demo",
fbos_version: "100.0.0",
}
record = Telemetries::Create.run!(p)
record.update!(created_at: Time.now - 1.days + up.seconds)
end
device
.update!(fbos_version: READ_COMMENT_ABOVE)
device
Expand Down
11 changes: 11 additions & 0 deletions app/mutations/devices/seeders/plant_fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 400.0
y: 100.0
z: 0.0
Expand All @@ -18,6 +19,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 400.0
y: 300.0
z: 0.0
Expand All @@ -29,6 +31,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 600.0
y: 100.0
z: 0.0
Expand All @@ -40,6 +43,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 600.0
y: 300.0
z: 0.0
Expand All @@ -51,6 +55,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 800.0
y: 300.0
z: 0.0
Expand All @@ -62,6 +67,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 800.0
y: 100.0
z: 0.0
Expand All @@ -73,6 +79,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 600.0
y: 700.0
z: 0.0
Expand All @@ -84,6 +91,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 800.0
y: 1100.0
z: 0.0
Expand All @@ -95,6 +103,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 600.0
y: 1100.0
z: 0.0
Expand All @@ -106,6 +115,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 400.0
y: 1100.0
z: 0.0
Expand All @@ -117,6 +127,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 200.0
y: 1100.0
z: 0.0
9 changes: 9 additions & 0 deletions app/mutations/devices/seeders/tool_slot_fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
planted_at:
pullout_direction: 1
radius: 25.0
depth: 0
x: 50.0
y: 100.0
z: -200.0
Expand All @@ -18,6 +19,7 @@
planted_at:
pullout_direction: 1
radius: 25.0
depth: 0
x: 50.0
y: 500.0
z: -200.0
Expand All @@ -29,6 +31,7 @@
planted_at:
pullout_direction: 1
radius: 25.0
depth: 0
x: 50.0
y: 200.0
z: -200.0
Expand All @@ -40,6 +43,7 @@
planted_at:
pullout_direction: 1
radius: 25.0
depth: 0
x: 50.0
y: 300.0
z: -200.0
Expand All @@ -51,6 +55,7 @@
planted_at:
pullout_direction: 1
radius: 25.0
depth: 0
x: 50.0
y: 600.0
z: -200.0
Expand All @@ -62,6 +67,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 0.0
y: 25.0
z: -200.0
Expand All @@ -73,6 +79,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 0.0
y: 50.0
z: -200.0
Expand All @@ -84,6 +91,7 @@
planted_at:
pullout_direction: 1
radius: 25.0
depth: 0
x: 50.0
y: 700.0
z: -200.0
Expand All @@ -95,6 +103,7 @@
planted_at:
pullout_direction: 0
radius: 25.0
depth: 0
x: 0.0
y: 75.0
z: -200.0
1 change: 1 addition & 0 deletions app/mutations/points/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Create < Mutations::Command
optional do
hstore :meta
float :radius, default: 25
integer :depth, default: 0
integer :pullout_direction,
min: ToolSlot::PULLOUT_DIRECTIONS.min,
max: ToolSlot::PULLOUT_DIRECTIONS.max
Expand Down
1 change: 1 addition & 0 deletions app/mutations/points/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Query < Mutations::Command

optional do
float :radius
integer :depth
float :x
float :y
float :z
Expand Down
1 change: 1 addition & 0 deletions app/mutations/points/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Update < Mutations::Command
float :y
float :z
float :radius
integer :depth
string :name
string :openfarm_slug
integer :pullout_direction, in: ToolSlot::PULLOUT_DIRECTIONS
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/plant_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class PlantSerializer < BasePointSerializer
attributes :openfarm_slug, :plant_stage, :planted_at, :radius, :meta
attributes :openfarm_slug, :plant_stage, :planted_at, :radius, :depth, :meta

def x
object.x.round
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20221027211207_add_depth_to_points.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddDepthToPoints < ActiveRecord::Migration[6.1]
def up
add_column :points, :depth, :integer, default: 0
end

def down
remove_column :points, :depth
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddDefaultPlantDepthToWebAppConfig < ActiveRecord::Migration[6.1]
def up
add_column :web_app_configs, :default_plant_depth, :integer, default: 0
end

def down
remove_column :web_app_configs, :default_plant_depth
end
end
5 changes: 5 additions & 0 deletions db/migrate/20221103172100_change_default_plant_depth.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeDefaultPlantDepth < ActiveRecord::Migration[6.1]
def change
change_column_default(:web_app_configs, :default_plant_depth, 5)
end
end
11 changes: 8 additions & 3 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,8 @@ CREATE TABLE public.points (
tool_id integer,
pullout_direction integer DEFAULT 0,
discarded_at timestamp without time zone,
gantry_mounted boolean DEFAULT false
gantry_mounted boolean DEFAULT false,
depth integer DEFAULT 0
);


Expand Down Expand Up @@ -1948,7 +1949,8 @@ CREATE TABLE public.web_app_configs (
beep_verbosity integer DEFAULT 0,
landing_page character varying(100) DEFAULT 'controls'::character varying,
go_button_axes character varying(3) DEFAULT 'XY'::character varying NOT NULL,
show_uncropped_camera_view_area boolean DEFAULT false
show_uncropped_camera_view_area boolean DEFAULT false,
default_plant_depth integer DEFAULT 5
);


Expand Down Expand Up @@ -3831,6 +3833,9 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220415191331'),
('20220620225957'),
('20220810212545'),
('20220819170955');
('20220819170955'),
('20221027211207'),
('20221028172528'),
('20221103172100');


Loading

0 comments on commit 8138a5c

Please sign in to comment.