1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00

fix bug for update event recurrent

This commit is contained in:
Du Peng 2020-01-30 12:03:50 +01:00
parent fd0f49f132
commit 05073d5a28

View File

@ -123,7 +123,7 @@ class EventService
amount: epca['amount'], amount: epca['amount'],
_destroy: epca['_destroy'] _destroy: epca['_destroy']
) )
else elsif epca['id'].present?
event_price = event.event_price_categories.find(epca['id']) event_price = event.event_price_categories.find(epca['id'])
epc_attributes.push( epc_attributes.push(
price_category_id: epca['price_category_id'], price_category_id: epca['price_category_id'],
@ -154,14 +154,20 @@ class EventService
ef_attributes.push(efa) ef_attributes.push(efa)
end end
end end
unless ef_attributes.empty? e_params = e_params.merge(
e_params = e_params.merge( event_files_attributes: ef_attributes
event_files_attributes: ef_attributes )
) begin
results.push status: !!e.update(e_params.permit!), event: e # rubocop:disable Style/DoubleNegation
rescue => err
results.push status: false, event: e, error: err.try(:record).try(:class).try(:name), message: err.message # rubocop:disable Style/DoubleNegation
end end
results.push status: !!e.update(e_params.permit!), event: e # rubocop:disable Style/DoubleNegation
end end
results.push status: !!event.update(event_params), event: event # rubocop:disable Style/DoubleNegation begin
results.push status: !!event.update(event_params), event: event # rubocop:disable Style/DoubleNegation
rescue => err
results.push status: false, event: event, error: err.try(:record).try(:class).try(:name), message: err.message # rubocop:disable Style/DoubleNegation
end
results results
end end
end end