Skip to content

Commit 9f14835

Browse files
authored
Merge pull request #1283 from Freika/dev
0.26.7
2 parents d9edc96 + dc87cec commit 9f14835

30 files changed

+2175
-122
lines changed

.app_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.26.6
1+
0.26.7

.circleci/config.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,36 @@ orbs:
77
jobs:
88
test:
99
docker:
10-
- image: cimg/ruby:3.4.1
10+
- image: cimg/ruby:3.4.1-browsers
1111
environment:
1212
RAILS_ENV: test
13+
CI: true
1314
- image: cimg/postgres:13.3-postgis
1415
environment:
1516
POSTGRES_USER: postgres
1617
POSTGRES_DB: test_database
1718
POSTGRES_PASSWORD: mysecretpassword
1819
- image: redis:7.0
20+
- image: selenium/standalone-chrome:latest
21+
name: chrome
22+
environment:
23+
START_XVFB: 'false'
24+
JAVA_OPTS: -Dwebdriver.chrome.whitelistedIps=
1925

2026
steps:
2127
- checkout
28+
- browser-tools/install-chrome
29+
- browser-tools/install-chromedriver
2230
- run:
2331
name: Install Bundler
2432
command: gem install bundler
2533
- run:
2634
name: Bundle Install
2735
command: bundle install --jobs=4 --retry=3
36+
- run:
37+
name: Wait for Selenium Chrome
38+
command: |
39+
dockerize -wait tcp://chrome:4444 -timeout 1m
2840
- run:
2941
name: Database Setup
3042
command: |
@@ -35,6 +47,8 @@ jobs:
3547
command: bundle exec rspec
3648
- store_artifacts:
3749
path: coverage
50+
- store_artifacts:
51+
path: tmp/capybara
3852

3953
workflows:
4054
rspec:

.github/workflows/ci.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,33 @@ jobs:
4949
- name: Install Ruby dependencies
5050
run: bundle install
5151

52-
- name: Run tests
52+
- name: Run bundler audit
53+
run: |
54+
gem install bundler-audit
55+
bundle audit --update
56+
57+
- name: Setup database
58+
env:
59+
RAILS_ENV: test
60+
DATABASE_URL: postgres://postgres:postgres@localhost:5432
61+
REDIS_URL: redis://localhost:6379/1
62+
run: bin/rails db:setup
63+
64+
- name: Run main tests (excluding system tests)
65+
env:
66+
RAILS_ENV: test
67+
DATABASE_URL: postgres://postgres:postgres@localhost:5432
68+
REDIS_URL: redis://localhost:6379/1
69+
run: |
70+
bundle exec rspec --exclude-pattern "spec/system/**/*_spec.rb" || (cat log/test.log && exit 1)
71+
72+
- name: Run system tests
5373
env:
5474
RAILS_ENV: test
5575
DATABASE_URL: postgres://postgres:postgres@localhost:5432
5676
REDIS_URL: redis://localhost:6379/1
5777
run: |
58-
bin/rails db:setup
59-
bin/rails spec || (cat log/test.log && exit 1)
78+
bundle exec rspec spec/system/ || (cat log/test.log && exit 1)
6079
6180
- name: Keep screenshots from failed system tests
6281
uses: actions/upload-artifact@v4

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77

8+
# 0.26.7 - 2025-05-26
9+
10+
## Fixed
11+
12+
- Popups now showing distance in the correct distance unit. #1258
13+
14+
## Added
15+
16+
- Bunch of system tests to cover map interactions.
17+
18+
819
# 0.26.6 - 2025-05-22
920

1021
## Added

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ gem 'jwt'
4949

5050
group :development, :test do
5151
gem 'brakeman', require: false
52+
gem 'bundler-audit', require: false
5253
gem 'debug', platforms: %i[mri mingw x64_mingw]
5354
gem 'dotenv-rails'
5455
gem 'factory_bot_rails'
@@ -60,7 +61,9 @@ group :development, :test do
6061
end
6162

6263
group :test do
64+
gem 'capybara'
6365
gem 'fakeredis'
66+
gem 'selenium-webdriver'
6467
gem 'shoulda-matchers'
6568
gem 'simplecov', require: false
6669
gem 'super_diff'

Gemfile.lock

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,24 @@ GEM
9999
bcrypt (3.1.20)
100100
benchmark (0.4.0)
101101
bigdecimal (3.1.9)
102-
bootsnap (1.18.4)
102+
bootsnap (1.18.6)
103103
msgpack (~> 1.2)
104104
brakeman (7.0.2)
105105
racc
106106
builder (3.3.0)
107+
bundler-audit (0.9.2)
108+
bundler (>= 1.2.0, < 3)
109+
thor (~> 1.0)
107110
byebug (12.0.0)
111+
capybara (3.40.0)
112+
addressable
113+
matrix
114+
mini_mime (>= 0.1.3)
115+
nokogiri (~> 1.11)
116+
rack (>= 1.6.0)
117+
rack-test (>= 0.6.3)
118+
regexp_parser (>= 1.5, < 3.0)
119+
xpath (~> 3.2)
108120
chartkick (5.1.5)
109121
coderay (1.1.3)
110122
concurrent-ruby (1.3.5)
@@ -132,13 +144,14 @@ GEM
132144
railties (>= 4.1.0)
133145
responders
134146
warden (~> 1.2.3)
135-
diff-lcs (1.5.1)
147+
diff-lcs (1.6.2)
136148
docile (1.4.1)
137149
dotenv (3.1.7)
138150
dotenv-rails (3.1.7)
139151
dotenv (= 3.1.7)
140152
railties (>= 6.1)
141-
drb (2.2.1)
153+
drb (2.2.3)
154+
erb (5.0.1)
142155
erubi (1.13.1)
143156
et-orbi (1.2.11)
144157
tzinfo
@@ -161,8 +174,8 @@ GEM
161174
gpx (1.2.0)
162175
nokogiri (~> 1.7)
163176
rake
164-
groupdate (6.5.1)
165-
activesupport (>= 7)
177+
groupdate (6.6.0)
178+
activesupport (>= 7.1)
166179
hashdiff (1.1.2)
167180
httparty (0.23.1)
168181
csv
@@ -205,7 +218,7 @@ GEM
205218
activesupport (>= 4)
206219
railties (>= 4)
207220
request_store (~> 1.0)
208-
loofah (2.24.0)
221+
loofah (2.24.1)
209222
crass (~> 1.0.2)
210223
nokogiri (>= 1.12.0)
211224
mail (2.8.1)
@@ -214,11 +227,12 @@ GEM
214227
net-pop
215228
net-smtp
216229
marcel (1.0.4)
230+
matrix (0.4.2)
217231
method_source (1.1.0)
218232
mini_mime (1.1.5)
219-
mini_portile2 (2.8.8)
233+
mini_portile2 (2.8.9)
220234
minitest (5.25.5)
221-
msgpack (1.7.3)
235+
msgpack (1.8.0)
222236
multi_json (1.15.0)
223237
multi_xml (0.7.1)
224238
bigdecimal (~> 3.1)
@@ -245,7 +259,7 @@ GEM
245259
racc (~> 1.4)
246260
nokogiri (1.18.8-x86_64-linux-gnu)
247261
racc (~> 1.4)
248-
oj (3.16.9)
262+
oj (3.16.10)
249263
bigdecimal (>= 3.0)
250264
ostruct (>= 0.2)
251265
optimist (3.2.0)
@@ -272,7 +286,7 @@ GEM
272286
pry (>= 0.13, < 0.16)
273287
pry-rails (0.3.11)
274288
pry (>= 0.13.0)
275-
psych (5.2.4)
289+
psych (5.2.6)
276290
date
277291
stringio
278292
public_suffix (6.0.1)
@@ -283,7 +297,7 @@ GEM
283297
raabro (1.4.0)
284298
racc (1.8.1)
285299
rack (3.1.15)
286-
rack-session (2.1.0)
300+
rack-session (2.1.1)
287301
base64 (>= 0.1.0)
288302
rack (>= 3.0.0)
289303
rack-test (2.2.0)
@@ -304,7 +318,7 @@ GEM
304318
activesupport (= 8.0.2)
305319
bundler (>= 1.15.0)
306320
railties (= 8.0.2)
307-
rails-dom-testing (2.2.0)
321+
rails-dom-testing (2.3.0)
308322
activesupport (>= 5.0.0)
309323
minitest
310324
nokogiri (>= 1.6)
@@ -321,7 +335,8 @@ GEM
321335
zeitwerk (~> 2.6)
322336
rainbow (3.1.1)
323337
rake (13.2.1)
324-
rdoc (6.13.1)
338+
rdoc (6.14.0)
339+
erb
325340
psych (>= 4.0.0)
326341
redis (5.4.0)
327342
redis-client (>= 0.22.0)
@@ -345,21 +360,21 @@ GEM
345360
rgeo (>= 1.0.0)
346361
rspec-core (3.13.3)
347362
rspec-support (~> 3.13.0)
348-
rspec-expectations (3.13.3)
363+
rspec-expectations (3.13.4)
349364
diff-lcs (>= 1.2.0, < 2.0)
350365
rspec-support (~> 3.13.0)
351-
rspec-mocks (3.13.2)
366+
rspec-mocks (3.13.4)
352367
diff-lcs (>= 1.2.0, < 2.0)
353368
rspec-support (~> 3.13.0)
354-
rspec-rails (7.1.1)
355-
actionpack (>= 7.0)
356-
activesupport (>= 7.0)
357-
railties (>= 7.0)
369+
rspec-rails (8.0.0)
370+
actionpack (>= 7.2)
371+
activesupport (>= 7.2)
372+
railties (>= 7.2)
358373
rspec-core (~> 3.13)
359374
rspec-expectations (~> 3.13)
360375
rspec-mocks (~> 3.13)
361376
rspec-support (~> 3.13)
362-
rspec-support (3.13.2)
377+
rspec-support (3.13.3)
363378
rswag-api (2.16.0)
364379
activesupport (>= 5.2, < 8.1)
365380
railties (>= 5.2, < 8.1)
@@ -392,11 +407,18 @@ GEM
392407
rubocop (>= 1.75.0, < 2.0)
393408
rubocop-ast (>= 1.44.0, < 2.0)
394409
ruby-progressbar (1.13.0)
410+
rubyzip (2.4.1)
395411
securerandom (0.4.1)
396-
sentry-rails (5.23.0)
412+
selenium-webdriver (4.33.0)
413+
base64 (~> 0.2)
414+
logger (~> 1.4)
415+
rexml (~> 3.2, >= 3.2.5)
416+
rubyzip (>= 1.2.2, < 3.0)
417+
websocket (~> 1.0)
418+
sentry-rails (5.24.0)
397419
railties (>= 5.0)
398-
sentry-ruby (~> 5.23.0)
399-
sentry-ruby (5.23.0)
420+
sentry-ruby (~> 5.24.0)
421+
sentry-ruby (5.24.0)
400422
bigdecimal
401423
concurrent-ruby (~> 1.0, >= 1.0.2)
402424
shoulda-matchers (6.5.0)
@@ -466,11 +488,14 @@ GEM
466488
crack (>= 0.3.2)
467489
hashdiff (>= 0.4.0, < 2.0.0)
468490
webrick (1.9.1)
491+
websocket (1.2.11)
469492
websocket-driver (0.7.7)
470493
base64
471494
websocket-extensions (>= 0.1.0)
472495
websocket-extensions (0.1.5)
473-
zeitwerk (2.7.2)
496+
xpath (3.2.0)
497+
nokogiri (~> 1.8)
498+
zeitwerk (2.7.3)
474499

475500
PLATFORMS
476501
aarch64-linux
@@ -487,6 +512,8 @@ DEPENDENCIES
487512
aws-sdk-s3 (~> 1.177.0)
488513
bootsnap
489514
brakeman
515+
bundler-audit
516+
capybara
490517
chartkick
491518
data_migrate
492519
database_consistency
@@ -523,6 +550,7 @@ DEPENDENCIES
523550
rswag-specs
524551
rswag-ui
525552
rubocop-rails
553+
selenium-webdriver
526554
sentry-rails
527555
sentry-ruby
528556
shoulda-matchers

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ You can track your location with the following apps:
5050
- 🌍 [Overland](https://dawarich.app/docs/tutorials/track-your-location#overland)
5151
- 🛰️ [OwnTracks](https://dawarich.app/docs/tutorials/track-your-location#owntracks)
5252
- 🗺️ [GPSLogger](https://dawarich.app/docs/tutorials/track-your-location#gps-logger)
53+
- 📱 [PhoneTrack](https://dawarich.app/docs/tutorials/track-your-location#phonetrack)
5354
- 🏡 [Home Assistant](https://dawarich.app/docs/tutorials/track-your-location#homeassistant)
5455

5556
Simply install one of the supported apps on your device and configure it to send location updates to your Dawarich instance.

app/assets/builds/tailwind.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/javascript/controllers/maps_controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default class extends BaseController {
4848
this.fogLinethreshold = parseInt(this.userSettings.fog_of_war_threshold) || 90;
4949
// Store route opacity as decimal (0-1) internally
5050
this.routeOpacity = parseFloat(this.userSettings.route_opacity) || 0.6;
51-
this.distanceUnit = this.userSettings.distance_unit || "km";
51+
this.distanceUnit = this.userSettings.maps?.distance_unit || "km";
5252
this.pointsRenderingMode = this.userSettings.points_rendering_mode || "raw";
5353
this.liveMapEnabled = this.userSettings.live_map_enabled || false;
5454
this.countryCodesMap = countryCodesMap();

app/javascript/maps/helpers.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ export function formatDate(timestamp, timezone) {
6666
return date.toLocaleString(locale, { timeZone: timezone });
6767
}
6868

69+
export function formatSpeed(speedKmh, unit = 'km') {
70+
if (unit === 'km') {
71+
return `${Math.round(speedKmh)} km/h`;
72+
} else {
73+
const speedMph = speedKmh * 0.621371; // Convert km/h to mph
74+
return `${Math.round(speedMph)} mph`;
75+
}
76+
}
77+
6978
export function haversineDistance(lat1, lon1, lat2, lon2, unit = 'km') {
7079
// Haversine formula to calculate the distance between two points
7180
const toRad = (x) => (x * Math.PI) / 180;

app/javascript/maps/polylines.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { formatDate } from "../maps/helpers";
22
import { formatDistance } from "../maps/helpers";
3+
import { formatSpeed } from "../maps/helpers";
34
import { minutesToDaysHoursMinutes } from "../maps/helpers";
45
import { haversineDistance } from "../maps/helpers";
56

@@ -224,7 +225,7 @@ export function addHighlightOnHover(polylineGroup, map, polylineCoordinates, use
224225
<strong>End:</strong> ${lastTimestamp}<br>
225226
<strong>Duration:</strong> ${timeOnRoute}<br>
226227
<strong>Total Distance:</strong> ${formatDistance(totalDistance, distanceUnit)}<br>
227-
<strong>Current Speed:</strong> ${Math.round(speed)} km/h
228+
<strong>Current Speed:</strong> ${formatSpeed(speed, distanceUnit)}
228229
`;
229230

230231
if (hoverPopup) {
@@ -318,7 +319,7 @@ export function addHighlightOnHover(polylineGroup, map, polylineCoordinates, use
318319
<strong>End:</strong> ${lastTimestamp}<br>
319320
<strong>Duration:</strong> ${timeOnRoute}<br>
320321
<strong>Total Distance:</strong> ${formatDistance(totalDistance, distanceUnit)}<br>
321-
<strong>Current Speed:</strong> ${Math.round(clickedLayer.options.speed || 0)} km/h
322+
<strong>Current Speed:</strong> ${formatSpeed(clickedLayer.options.speed || 0, distanceUnit)}
322323
`;
323324

324325
if (hoverPopup) {

0 commit comments

Comments
 (0)