diff --git a/.app_version b/.app_version index e3e18070..56f31511 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.9.8 +0.9.10 diff --git a/.env.development b/.env.development index 8aeb3141..08a48784 100644 --- a/.env.development +++ b/.env.development @@ -4,3 +4,4 @@ DATABASE_PASSWORD=password DATABASE_NAME=dawarich_development DATABASE_PORT=5432 REDIS_URL=redis://localhost:6379/1 +PHOTON_API_HOST='photon.komoot.io' diff --git a/CHANGELOG.md b/CHANGELOG.md index 50875158..3c587bba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.9.10] — 2024-08-14 + +### Added + +- PHOTON_API_HOST env variable to set the host of the Photon API. It will allow you to use your own Photon API instance instead of the default one. ## [0.9.9] — 2024-07-30 diff --git a/app/services/own_tracks/params.rb b/app/services/own_tracks/params.rb index b60d6220..d2f40628 100644 --- a/app/services/own_tracks/params.rb +++ b/app/services/own_tracks/params.rb @@ -11,22 +11,22 @@ class OwnTracks::Params { latitude: params[:lat], longitude: params[:lon], - battery_status: battery_status, battery: params[:batt], ping: params[:p], altitude: params[:alt], accuracy: params[:acc], vertical_accuracy: params[:vac], velocity: params[:vel], - connection: connection, ssid: params[:SSID], bssid: params[:BSSID], - trigger: trigger, tracker_id: params[:tid], timestamp: params[:tst].to_i, inrids: params[:inrids], in_regions: params[:inregions], topic: params[:topic], + battery_status:, + connection:, + trigger:, raw_data: params.deep_stringify_keys } end diff --git a/config/initializers/00_constants.rb b/config/initializers/00_constants.rb index 803dd0f1..7251d114 100644 --- a/config/initializers/00_constants.rb +++ b/config/initializers/00_constants.rb @@ -2,3 +2,4 @@ MIN_MINUTES_SPENT_IN_CITY = ENV.fetch('MIN_MINUTES_SPENT_IN_CITY', 60).to_i REVERSE_GEOCODING_ENABLED = ENV.fetch('REVERSE_GEOCODING_ENABLED', 'true') == 'true' +PHOTON_API_HOST = ENV.fetch('PHOTON_API_HOST', nil) diff --git a/config/initializers/geocoder.rb b/config/initializers/geocoder.rb index baa9cf53..5352049e 100644 --- a/config/initializers/geocoder.rb +++ b/config/initializers/geocoder.rb @@ -1,16 +1,18 @@ # frozen_string_literal: true -Geocoder.configure( - # geocoding service request timeout, in seconds (default 3): - # timeout: 5, - - # set default units to kilometers: +settings = { + timeout: 5, units: :km, - - # caching (see Caching section below for details): cache: Redis.new, + always_raise: :all, cache_options: { - expiration: 1.day # Defaults to `nil` - # prefix: "another_key:" # Defaults to `geocoder:` + expiration: 1.day } -) +} + +if defined?(PHOTON_API_HOST) + settings[:lookup] = :photon + settings[:photon] = { host: PHOTON_API_HOST } +end + +Geocoder.configure(settings) diff --git a/spec/jobs/area_visits_calculation_scheduling_job_spec.rb b/spec/jobs/area_visits_calculation_scheduling_job_spec.rb index 0d375e67..93fd053a 100644 --- a/spec/jobs/area_visits_calculation_scheduling_job_spec.rb +++ b/spec/jobs/area_visits_calculation_scheduling_job_spec.rb @@ -8,9 +8,11 @@ RSpec.describe AreaVisitsCalculationSchedulingJob, type: :job do let(:user) { create(:user) } it 'calls the AreaVisitsCalculationService' do - expect(AreaVisitsCalculatingJob).to receive(:perform_later).with(user.id).and_call_original + Sidekiq::Testing.inline! do + expect(AreaVisitsCalculatingJob).to receive(:perform_later).with(user.id).and_call_original - described_class.new.perform + described_class.new.perform + end end end end diff --git a/spec/requests/settings/users_spec.rb b/spec/requests/settings/users_spec.rb index 3162cc8d..075cac7b 100644 --- a/spec/requests/settings/users_spec.rb +++ b/spec/requests/settings/users_spec.rb @@ -27,9 +27,9 @@ RSpec.describe '/settings/users', type: :request do context 'when user is an admin' do let!(:admin) { create(:user, :admin) } - before { sign_in admin } - describe 'POST /create' do + before { sign_in admin } + context 'with valid parameters' do it 'creates a new User' do expect do