Merge pull request #1567 from Freika/fix/basecamp-gpx

Implement Basecamp GPX import
This commit is contained in:
Evgenii Burmakin 2025-07-26 15:17:23 +02:00 committed by GitHub
commit f8c509912b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View file

@ -16,10 +16,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- The Warden error in jobs is now fixed. #1556 - The Warden error in jobs is now fixed. #1556
- The Live Map setting is now respected. - The Live Map setting is now respected.
- The Live Map info modal is now displayed. #665 - The Live Map info modal is now displayed. #665
- GPX from Basecamp is now supported. #790
- The "Delete Selected" button is now hidden when no points are selected. #1025 - The "Delete Selected" button is now hidden when no points are selected. #1025
# [0.30.3] - 2025-07-23 # [0.30.3] - 2025-07-23
## Changed ## Changed

View file

@ -17,7 +17,7 @@ class Point < ApplicationRecord
index: true index: true
} }
enum :battery_status, { unknown: 0, unplugged: 1, charging: 2, full: 3 }, suffix: true enum :battery_status, { unknown: 0, unplugged: 1, charging: 2, full: 3, connected_not_charging: 4 }, suffix: true
enum :trigger, { enum :trigger, {
unknown: 0, background_event: 1, circular_region_event: 2, beacon_event: 3, unknown: 0, background_event: 1, circular_region_event: 2, beacon_event: 3,
report_location_message_event: 4, manual_event: 5, timer_based_event: 6, report_location_message_event: 4, manual_event: 5, timer_based_event: 6,

View file

@ -81,8 +81,10 @@ class Gpx::TrackImporter
def speed(point) def speed(point)
return if point['extensions'].blank? return if point['extensions'].blank?
( value = point.dig('extensions', 'speed')
point.dig('extensions', 'speed') || point.dig('extensions', 'TrackPointExtension', 'speed') extensions = point.dig('extensions', 'TrackPointExtension')
).to_f.round(1) value ||= extensions.is_a?(Hash) ? extensions.dig('speed') : nil
value&.to_f&.round(1) || 0.0
end end
end end