Skip to content

Commit

Permalink
remove hardware description
Browse files Browse the repository at this point in the history
  • Loading branch information
timcowlishaw committed Feb 28, 2024
1 parent 821eaaa commit eacb53e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 25 deletions.
5 changes: 0 additions & 5 deletions app/models/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ def hardware(authorized=false)
{
name: hardware_name,
type: hardware_type,
description: hardware_description,
version: hardware_version,
slug: hardware_slug,
info: authorized ? hardware_info : "[FILTERED]",
Expand All @@ -288,10 +287,6 @@ def hardware_type
hardware_type_override || (hardware_version ? "SCK" : "Unknown")
end

def hardware_description
hardware_description_override || hardware_name
end

def hardware_version
hardware_version_override || hardware_info&.fetch('hw_ver', nil)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveHardwareDescriptionOverrideFromDevices < ActiveRecord::Migration[6.1]
def change
remove_column :devices, :hardware_description_override, :string
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_10_06_064514) do
ActiveRecord::Schema.define(version: 2024_02_28_125910) do

# These are extensions that must be enabled in order to support this database
enable_extension "adminpack"
Expand Down Expand Up @@ -104,7 +104,6 @@
t.string "hardware_type_override"
t.string "hardware_name_override"
t.string "hardware_version_override"
t.string "hardware_description_override"
t.string "hardware_slug_override"
t.index ["device_token"], name: "index_devices_on_device_token", unique: true
t.index ["geohash"], name: "index_devices_on_geohash"
Expand Down
18 changes: 0 additions & 18 deletions spec/models/device_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -496,24 +496,6 @@
end
end

describe "hardware_description" do
context "when it has a description override" do
it "returns the overriden description" do
device = create(:device, hardware_description_override: "Overriden description")
expect(device.hardware_description).to eq("Overriden description")
end
end

context "otherwise" do
it "returns the hardware_name" do
device = create(:device)
expect(device).to receive(:hardware_name).and_return("Hardware name")
expect(device.hardware_description).to eq("Hardware name")
end

end
end

describe "hardware_slug" do
context "when it has a slug override" do
it "returns the overriden slug" do
Expand Down

0 comments on commit eacb53e

Please sign in to comment.