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

Fix updating conversion_status in Update Service

Wieland Lindenthal28571eac2609
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 db68ec70002..5812ff77b36 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 1f20d75e9ae..d71cd129fd9 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)