mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 08:43:23 -05:00
BikeCsvImporter: add dummy field values for "bike_condition_id", "bike_wheel_size_id", "bike_style_id", "serial_number", "seat_tube_height"
This commit is contained in:
parent
802db2ba34
commit
cfe81d6e65
@ -98,7 +98,7 @@ class BikeCsvImporter
|
||||
end
|
||||
|
||||
def bike_attrs(bike_hash)
|
||||
%i{ shop_id bike_purpose_id value bike_brand_id bike_model_id model }.each_with_object({}) do |field, memo|
|
||||
%i{ shop_id bike_purpose_id value bike_brand_id bike_model_id model bike_style_id bike_condition_id seat_tube_height bike_wheel_size_id serial_number }.each_with_object({}) do |field, memo|
|
||||
memo[field] = send :"bike_attr_#{ field }", bike_hash
|
||||
end
|
||||
end
|
||||
@ -148,6 +148,26 @@ class BikeCsvImporter
|
||||
model unless model =~ /unknown/i
|
||||
end
|
||||
|
||||
def bike_attr_bike_style_id(_)
|
||||
@bike_style_other_cache ||= BikeStyle.find_by_style('OTHER').id
|
||||
end
|
||||
|
||||
def bike_attr_bike_condition_id(_)
|
||||
@bike_condition_undertermined_cache ||= BikeCondition.find_by_condition('UNDETERMINED').id
|
||||
end
|
||||
|
||||
def bike_attr_seat_tube_height(_)
|
||||
0
|
||||
end
|
||||
|
||||
def bike_attr_bike_wheel_size_id(_)
|
||||
@bike_condition_wheel_size_undertermined_cache ||= BikeWheelSize.find_by_description('UNDETERMINED').id
|
||||
end
|
||||
|
||||
def bike_attr_serial_number(_)
|
||||
'UNDETERMINED'
|
||||
end
|
||||
|
||||
def clean_value(value)
|
||||
value_or_nil strip_value(value)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user