diff --git a/app/models/device.rb b/app/models/device.rb index bcfdb98b..f4074a0f 100644 --- a/app/models/device.rb +++ b/app/models/device.rb @@ -291,7 +291,7 @@ def forwarding_token def truncate_and_fuzz_location! if latitude && longitude - fuzz_decimal_places = 3 + fuzz_decimal_places = 4 total_decimal_places = 5 lat_fuzz = self.precise_location ? 0.0 : (Random.rand * 1/10.0**fuzz_decimal_places) long_fuzz = self.precise_location ? 0.0 : (Random.rand * 1/10.0**fuzz_decimal_places) diff --git a/spec/models/device_spec.rb b/spec/models/device_spec.rb index 7e865a50..2b857d04 100644 --- a/spec/models/device_spec.rb +++ b/spec/models/device_spec.rb @@ -231,8 +231,8 @@ device.save expect(device.latitude).not_to eq(0.12345) expect(device.longitude).not_to eq(10.12345) - expect((device.latitude - 0.12345).abs.truncate(5)).to be <= 0.001 - expect((device.longitude - 10.12345).abs.truncate(5)).to be <= 0.001 + expect((device.latitude - 0.12345).abs.truncate(5)).to be <= 0.0001 + expect((device.longitude - 10.12345).abs.truncate(5)).to be <= 0.0001 end end end