2024-03-15 18:27:31 -04:00
|
|
|
class Point < ApplicationRecord
|
2024-05-21 17:09:21 -04:00
|
|
|
# self.ignored_columns = %w[raw_data]
|
2024-05-19 12:26:48 -04:00
|
|
|
|
2024-03-15 18:27:31 -04:00
|
|
|
belongs_to :import, optional: true
|
|
|
|
|
|
2024-04-06 13:09:38 -04:00
|
|
|
validates :latitude, :longitude, :timestamp, presence: true
|
2024-03-15 18:27:31 -04:00
|
|
|
|
|
|
|
|
enum battery_status: { unknown: 0, unplugged: 1, charging: 2, full: 3 }, _suffix: true
|
|
|
|
|
enum trigger: {
|
|
|
|
|
unknown: 0, background_event: 1, circular_region_event: 2, beacon_event: 3,
|
|
|
|
|
report_location_message_event: 4, manual_event: 5, timer_based_event: 6,
|
|
|
|
|
settings_monitoring_event: 7
|
|
|
|
|
}, _suffix: true
|
|
|
|
|
enum connection: { mobile: 0, wifi: 1, offline: 2 }, _suffix: true
|
|
|
|
|
|
|
|
|
|
after_create :async_reverse_geocode
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def async_reverse_geocode
|
2024-03-24 13:05:39 -04:00
|
|
|
return unless REVERSE_GEOCODING_ENABLED
|
|
|
|
|
|
2024-03-15 18:27:31 -04:00
|
|
|
ReverseGeocodingJob.perform_later(id)
|
|
|
|
|
end
|
|
|
|
|
end
|