Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Ensure that IfcModel's conversion status is reset on update

Wieland Lindenthal69fd660a101b
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 dc4167d591d..4176eff51a4 100644
--- a/modules/bim/app/services/bim/ifc_models/update_service.rb
+++ b/modules/bim/app/services/bim/ifc_models/update_service.rb
@@ -43,6 +43,10 @@ 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
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 9a588baa70c..1f20d75e9ae 100644
--- a/modules/bim/spec/services/ifc_models/update_service_spec.rb
+++ b/modules/bim/spec/services/ifc_models/update_service_spec.rb
@@ -134,6 +134,11 @@ describe Bim::IfcModels::UpdateService do
subject
end
+
+ it "sets the model's converstion_status to pending" do
+ expect(model).to be_pending
+ expect(model.conversion_error_message).to be_nil
+ end
end
context 'if the SetAttributeService is unsuccessful' do