Skip to content

Commit

Permalink
fix location converter to handle onsite boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
jambun committed Aug 21, 2024
1 parent f400be5 commit 632476f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions backend/plugin_init.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
LocationConverter.class_eval do
def self.normalize_boolean
@normalize_boolean ||= Proc.new {|val| val.to_s.upcase.match(/\A(1|T|Y|YES|TRUE)\Z/) ? true : false }
@normalize_boolean
end

def self.configure
{
'location_building' => 'location.building',
'location_floor' => 'location.floor',
'location_room' => 'location.room',
'location_area' => 'location.area',
'location_barcode' => 'location.barcode',
'location_classification' => 'location.classification',
'location_coordinate_1_label' => 'location.coordinate_1_label',
'location_coordinate_1_indicator' => 'location.coordinate_1_indicator',
'location_coordinate_2_label' => 'location.coordinate_2_label',
'location_coordinate_2_indicator' => 'location.coordinate_2_indicator',
'location_coordinate_3_label' => 'location.coordinate_3_label',
'location_coordinate_3_indicator' => 'location.coordinate_3_indicator',
'location_temporary' => 'location.temporary',
'location_onsite' => [normalize_boolean, 'location.onsite'],
}
end

end

0 comments on commit 632476f

Please sign in to comment.