mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Fix importing of GPX files with empty tracks and reduce number of points created for other GPX files.
This commit is contained in:
parent
6f7b724fce
commit
b8c69c2a76
7 changed files with 11 additions and 8295 deletions
|
|
@ -48,6 +48,7 @@ This will select points tracked between January 1st and January 31st 2025. Then
|
|||
- Fixed a bug where export file was not being deleted from the server after it was deleted. #808
|
||||
- After an area was drawn on the map, a popup is now being shown to allow user to provide a name and save the area. #740
|
||||
- Docker entrypoints now use database name to fix problem with custom database names.
|
||||
- Garmin GPX files with empty tracks are now being imported correctly. #827
|
||||
|
||||
### Added
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class Gpx::TrackParser
|
|||
segments = track['trkseg']
|
||||
segments_array = segments.is_a?(Array) ? segments : [segments]
|
||||
|
||||
segments_array.map { |segment| segment['trkpt'] }
|
||||
segments_array.compact.map { |segment| segment['trkpt'] }
|
||||
end
|
||||
|
||||
def create_point(point, index)
|
||||
|
|
|
|||
1
spec/fixtures/files/gpx/garmin_example.gpx
vendored
1
spec/fixtures/files/gpx/garmin_example.gpx
vendored
|
|
@ -27,5 +27,6 @@
|
|||
<pdop>8.8</pdop>
|
||||
</trkpt>
|
||||
</trkseg>
|
||||
<trkseg></trkseg>
|
||||
</trk>
|
||||
</gpx>
|
||||
|
|
|
|||
4122
spec/fixtures/files/gpx/gpx_track_multiple_segments.gpx
vendored
4122
spec/fixtures/files/gpx/gpx_track_multiple_segments.gpx
vendored
File diff suppressed because it is too large
Load diff
2984
spec/fixtures/files/gpx/gpx_track_multiple_tracks.gpx
vendored
2984
spec/fixtures/files/gpx/gpx_track_multiple_tracks.gpx
vendored
File diff suppressed because it is too large
Load diff
1180
spec/fixtures/files/gpx/gpx_track_single_segment.gpx
vendored
1180
spec/fixtures/files/gpx/gpx_track_single_segment.gpx
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -13,11 +13,11 @@ RSpec.describe Gpx::TrackParser do
|
|||
|
||||
context 'when file has a single segment' do
|
||||
it 'creates points' do
|
||||
expect { parser }.to change { Point.count }.by(301)
|
||||
expect { parser }.to change { Point.count }.by(10)
|
||||
end
|
||||
|
||||
it 'broadcasts importing progress' do
|
||||
expect_any_instance_of(Imports::Broadcaster).to receive(:broadcast_import_progress).exactly(301).times
|
||||
expect_any_instance_of(Imports::Broadcaster).to receive(:broadcast_import_progress).exactly(10).times
|
||||
|
||||
parser
|
||||
end
|
||||
|
|
@ -27,11 +27,11 @@ RSpec.describe Gpx::TrackParser do
|
|||
let(:file_path) { Rails.root.join('spec/fixtures/files/gpx/gpx_track_multiple_segments.gpx') }
|
||||
|
||||
it 'creates points' do
|
||||
expect { parser }.to change { Point.count }.by(558)
|
||||
expect { parser }.to change { Point.count }.by(43)
|
||||
end
|
||||
|
||||
it 'broadcasts importing progress' do
|
||||
expect_any_instance_of(Imports::Broadcaster).to receive(:broadcast_import_progress).exactly(558).times
|
||||
expect_any_instance_of(Imports::Broadcaster).to receive(:broadcast_import_progress).exactly(43).times
|
||||
|
||||
parser
|
||||
end
|
||||
|
|
@ -41,11 +41,11 @@ RSpec.describe Gpx::TrackParser do
|
|||
let(:file_path) { Rails.root.join('spec/fixtures/files/gpx/gpx_track_multiple_tracks.gpx') }
|
||||
|
||||
it 'creates points' do
|
||||
expect { parser }.to change { Point.count }.by(407)
|
||||
expect { parser }.to change { Point.count }.by(34)
|
||||
end
|
||||
|
||||
it 'broadcasts importing progress' do
|
||||
expect_any_instance_of(Imports::Broadcaster).to receive(:broadcast_import_progress).exactly(407).times
|
||||
expect_any_instance_of(Imports::Broadcaster).to receive(:broadcast_import_progress).exactly(34).times
|
||||
|
||||
parser
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue