Merge pull request #9857 from opf/fix/ifc-update-service

Fix updating conversion_status in Update Service
pull/9858/head
Markus Kahl 3 years ago committed by GitHub
commit 933c135159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      modules/bim/app/services/bim/ifc_models/update_service.rb
  2. 2
      modules/bim/spec/services/ifc_models/update_service_spec.rb

@ -43,13 +43,9 @@ module Bim
# attachments ourselves # attachments ourselves
model.attachments.select(&:marked_for_destruction?).each(&:destroy) 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 if @ifc_attachment_updated
model.update_attributes(conversion_status: ::Bim::IfcModels::IfcModel.conversion_statuses[:pending], model.update(conversion_status: ::Bim::IfcModels::IfcModel.conversion_statuses[:pending],
conversion_error_message: nil) conversion_error_message: nil)
IfcConversionJob.perform_later(service_result.result) IfcConversionJob.perform_later(service_result.result)
end end

@ -24,7 +24,7 @@ describe Bim::IfcModels::UpdateService do
errors: set_attributes_errors errors: set_attributes_errors
end end
let!(:model) do let!(:model) do
FactoryBot.build_stubbed(:ifc_model).tap do |m| FactoryBot.create(:ifc_model).tap do |m|
allow(m) allow(m)
.to receive(:save) .to receive(:save)
.and_return(model_valid) .and_return(model_valid)

Loading…
Cancel
Save