diff --git a/modules/bim/app/services/bim/ifc_models/update_service.rb b/modules/bim/app/services/bim/ifc_models/update_service.rb index db68ec7000..5812ff77b3 100644 --- a/modules/bim/app/services/bim/ifc_models/update_service.rb +++ b/modules/bim/app/services/bim/ifc_models/update_service.rb @@ -43,13 +43,9 @@ module Bim # attachments ourselves model.attachments.select(&:marked_for_destruction?).each(&:destroy) - model.conversion_status = ::Bim::IfcModels::IfcModel.conversion_statuses[:pending] - model.conversion_error_message = nil - model.save - if @ifc_attachment_updated - model.update_attributes(conversion_status: ::Bim::IfcModels::IfcModel.conversion_statuses[:pending], - conversion_error_message: nil) + model.update(conversion_status: ::Bim::IfcModels::IfcModel.conversion_statuses[:pending], + conversion_error_message: nil) IfcConversionJob.perform_later(service_result.result) end diff --git a/modules/bim/spec/services/ifc_models/update_service_spec.rb b/modules/bim/spec/services/ifc_models/update_service_spec.rb index 1f20d75e9a..d71cd129fd 100644 --- a/modules/bim/spec/services/ifc_models/update_service_spec.rb +++ b/modules/bim/spec/services/ifc_models/update_service_spec.rb @@ -24,7 +24,7 @@ describe Bim::IfcModels::UpdateService do errors: set_attributes_errors end let!(:model) do - FactoryBot.build_stubbed(:ifc_model).tap do |m| + FactoryBot.create(:ifc_model).tap do |m| allow(m) .to receive(:save) .and_return(model_valid)