mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
clean up
This commit is contained in:
parent
06406591d0
commit
c181a2f9a2
2 changed files with 2 additions and 22 deletions
|
|
@ -41,7 +41,6 @@ class OwnTracks::FamilyLocationsFormatter
|
||||||
alt: point.altitude,
|
alt: point.altitude,
|
||||||
batt: point.battery,
|
batt: point.battery,
|
||||||
bs: OwnTracks::Params.battery_status_to_numeric(point.battery_status),
|
bs: OwnTracks::Params.battery_status_to_numeric(point.battery_status),
|
||||||
# t: OwnTracks::Params.trigger_to_string(point.trigger),
|
|
||||||
vel: OwnTracks::Params.velocity_to_kmh(point.velocity),
|
vel: OwnTracks::Params.velocity_to_kmh(point.velocity),
|
||||||
conn: OwnTracks::Params.connection_to_string(point.connection),
|
conn: OwnTracks::Params.connection_to_string(point.connection),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,19 +103,6 @@ class OwnTracks::Params
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def trigger_to_string(trigger)
|
|
||||||
case trigger
|
|
||||||
when 'background_event' then 'p'
|
|
||||||
when 'circular_region_event' then 'c'
|
|
||||||
when 'beacon_event' then 'b'
|
|
||||||
when 'report_location_message_event' then 'r'
|
|
||||||
when 'manual_event' then 'u'
|
|
||||||
when 'timer_based_event' then 't'
|
|
||||||
when 'settings_monitoring_event' then 'v'
|
|
||||||
else nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def connection_to_string(connection)
|
def connection_to_string(connection)
|
||||||
case connection
|
case connection
|
||||||
when 'mobile' then 'm'
|
when 'mobile' then 'm'
|
||||||
|
|
@ -132,14 +119,8 @@ class OwnTracks::Params
|
||||||
velocity_float = velocity.to_f
|
velocity_float = velocity.to_f
|
||||||
return nil if velocity_float.zero?
|
return nil if velocity_float.zero?
|
||||||
|
|
||||||
# Velocity should be in km/h for Owntracks format (integer)
|
# Reference: https://owntracks.org/booklet/tech/json/
|
||||||
# If stored as m/s (typically < 50), convert to km/h
|
|
||||||
# Otherwise assume it's already in km/h
|
|
||||||
if velocity_float < 50
|
|
||||||
(velocity_float * 3.6).round.to_i
|
(velocity_float * 3.6).round.to_i
|
||||||
else
|
|
||||||
velocity_float.round.to_i
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue