mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01: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/)
|
||||
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
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -10,7 +10,7 @@ class OwnTracks::ExportParser
|
|||
end
|
||||
|
||||
def call
|
||||
points_data = parse_data
|
||||
points_data = data.map { |point| OwnTracks::Params.new(point).call }
|
||||
|
||||
points_data.each do |point_data|
|
||||
next if Point.exists?(
|
||||
|
|
@ -28,12 +28,4 @@ class OwnTracks::ExportParser
|
|||
point.save
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def parse_data
|
||||
json = OwnTracks::RecParser.new(data).call
|
||||
|
||||
json.map { |point| OwnTracks::Params.new(point).call }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ FactoryBot.define do
|
|||
user
|
||||
name { 'APRIL_2013.json' }
|
||||
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
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ RSpec.describe OwnTracks::ExportParser do
|
|||
'bssid' => 'b0:f2:8:45:94:33',
|
||||
'trigger' => 'background_event',
|
||||
'tracker_id' => 'RO',
|
||||
'timestamp' => 1709283789,
|
||||
'timestamp' => 1_709_283_789,
|
||||
'inrids' => ['5f1d1b'],
|
||||
'in_regions' => ['home'],
|
||||
'topic' => 'owntracks/test/iPhone 12 Pro',
|
||||
|
|
@ -40,27 +40,27 @@ RSpec.describe OwnTracks::ExportParser do
|
|||
'user_id' => user.id,
|
||||
'country' => nil,
|
||||
'raw_data' => {
|
||||
'm'=>1,
|
||||
'p'=>100.266,
|
||||
't'=>'p',
|
||||
'bs'=>2,
|
||||
'acc'=>10,
|
||||
'alt'=>36,
|
||||
'lat'=>52.225,
|
||||
'lon'=>13.332,
|
||||
'tid'=>'RO',
|
||||
'tst'=>1709283789,
|
||||
'vac'=>4,
|
||||
'vel'=>0,
|
||||
'SSID'=>'Home Wifi',
|
||||
'batt'=>94,
|
||||
'conn'=>'w',
|
||||
'BSSID'=>'b0:f2:8:45:94:33',
|
||||
'_http'=>true,
|
||||
'_type'=>'location',
|
||||
'topic'=>'owntracks/test/iPhone 12 Pro',
|
||||
'inrids'=>['5f1d1b'],
|
||||
'inregions'=>['home']
|
||||
'm' => 1,
|
||||
'p' => 100.266,
|
||||
't' => 'p',
|
||||
'bs' => 2,
|
||||
'acc' => 10,
|
||||
'alt' => 36,
|
||||
'lat' => 52.225,
|
||||
'lon' => 13.332,
|
||||
'tid' => 'RO',
|
||||
'tst' => 1_709_283_789,
|
||||
'vac' => 4,
|
||||
'vel' => 0,
|
||||
'SSID' => 'Home Wifi',
|
||||
'batt' => 94,
|
||||
'conn' => 'w',
|
||||
'BSSID' => 'b0:f2:8:45:94:33',
|
||||
'_http' => true,
|
||||
'_type' => 'location',
|
||||
'topic' => 'owntracks/test/iPhone 12 Pro',
|
||||
'inrids' => ['5f1d1b'],
|
||||
'inregions' => ['home']
|
||||
}
|
||||
)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue