Skip to content

Commit

Permalink
Merge pull request #364 from fablabbcn/precise-location-true-by-default
Browse files Browse the repository at this point in the history
Precise location should be on by default
  • Loading branch information
timcowlishaw authored Oct 7, 2024
2 parents 24d1925 + 02570c1 commit 676e8d7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeDevicePreciseLocationDefault < ActiveRecord::Migration[6.1]
def change
change_column_default :devices, :precise_location, from: false, to: true
end
end
5 changes: 3 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2024_08_12_081108) do
ActiveRecord::Schema.define(version: 2024_10_01_080033) do

# These are extensions that must be enabled in order to support this database
enable_extension "adminpack"
enable_extension "hstore"
Expand Down Expand Up @@ -104,7 +105,7 @@
t.string "hardware_name_override"
t.string "hardware_version_override"
t.string "hardware_slug_override"
t.boolean "precise_location", default: false, null: false
t.boolean "precise_location", default: true, null: false
t.boolean "enable_forwarding", default: false, null: false
t.index ["device_token"], name: "index_devices_on_device_token", unique: true
t.index ["geohash"], name: "index_devices_on_geohash"
Expand Down
10 changes: 10 additions & 0 deletions spec/models/device_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@
end

describe "location truncation and fuzzing" do

context "by default" do
it "saves the precise location" do
device = create(:device, latitude: 0.12345, longitude: 10.12345)
expect(device.precise_location).to eq(true)
expect(device.latitude).to eq(0.12345)
expect(device.longitude).to eq(10.12345)
end
end

context "when the location is changed" do
context "when the device has precise location set" do
let(:device) {
Expand Down

0 comments on commit 676e8d7

Please sign in to comment.