mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
Fix Owntracks .rec file import
This commit is contained in:
parent
0f3d6237c7
commit
50b77cc493
6 changed files with 32 additions and 34 deletions
|
|
@ -1 +1 @@
|
||||||
0.15.5
|
0.15.6
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
# 0.15.6 - 2024-10-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Import of Owntracks' .rec files now correctly imports points. Previously, the import was failing due to incorrect parsing of the file.
|
||||||
|
|
||||||
# 0.15.5 - 2024-10-16
|
# 0.15.5 - 2024-10-16
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -10,7 +10,7 @@ class OwnTracks::ExportParser
|
||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
points_data = parse_data
|
points_data = data.map { |point| OwnTracks::Params.new(point).call }
|
||||||
|
|
||||||
points_data.each do |point_data|
|
points_data.each do |point_data|
|
||||||
next if Point.exists?(
|
next if Point.exists?(
|
||||||
|
|
@ -28,12 +28,4 @@ class OwnTracks::ExportParser
|
||||||
point.save
|
point.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def parse_data
|
|
||||||
json = OwnTracks::RecParser.new(data).call
|
|
||||||
|
|
||||||
json.map { |point| OwnTracks::Params.new(point).call }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@ FactoryBot.define do
|
||||||
user
|
user
|
||||||
name { 'APRIL_2013.json' }
|
name { 'APRIL_2013.json' }
|
||||||
source { Import.sources[:owntracks] }
|
source { Import.sources[:owntracks] }
|
||||||
raw_data { File.read('spec/fixtures/files/owntracks/2024-03.rec') }
|
raw_data { OwnTracks::RecParser.new(File.read('spec/fixtures/files/owntracks/2024-03.rec')).call }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ RSpec.describe OwnTracks::ExportParser do
|
||||||
'bssid' => 'b0:f2:8:45:94:33',
|
'bssid' => 'b0:f2:8:45:94:33',
|
||||||
'trigger' => 'background_event',
|
'trigger' => 'background_event',
|
||||||
'tracker_id' => 'RO',
|
'tracker_id' => 'RO',
|
||||||
'timestamp' => 1709283789,
|
'timestamp' => 1_709_283_789,
|
||||||
'inrids' => ['5f1d1b'],
|
'inrids' => ['5f1d1b'],
|
||||||
'in_regions' => ['home'],
|
'in_regions' => ['home'],
|
||||||
'topic' => 'owntracks/test/iPhone 12 Pro',
|
'topic' => 'owntracks/test/iPhone 12 Pro',
|
||||||
|
|
@ -49,7 +49,7 @@ RSpec.describe OwnTracks::ExportParser do
|
||||||
'lat' => 52.225,
|
'lat' => 52.225,
|
||||||
'lon' => 13.332,
|
'lon' => 13.332,
|
||||||
'tid' => 'RO',
|
'tid' => 'RO',
|
||||||
'tst'=>1709283789,
|
'tst' => 1_709_283_789,
|
||||||
'vac' => 4,
|
'vac' => 4,
|
||||||
'vel' => 0,
|
'vel' => 0,
|
||||||
'SSID' => 'Home Wifi',
|
'SSID' => 'Home Wifi',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue