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

Renaming return value from service to service_result

Wieland Lindenthalc860b5df4281
diff --git a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb
index 61706953edf..f60a2d1267c 100644
--- a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb
+++ b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb
@@ -106,24 +106,24 @@ module Bim
ifc_model = Bim::IfcModels::IfcModel.find_by id: session[:pending_ifc_model_ifc_model_id]
new_model = false
- call = ::Bim::IfcModels::UpdateService
+ service_result = ::Bim::IfcModels::UpdateService
.new(user: current_user, model: ifc_model)
.call(params.with_indifferent_access)
- @ifc_model = call.result
+ @ifc_model = service_result.result
else
- call = ::Bim::IfcModels::CreateService
+ service_result = ::Bim::IfcModels::CreateService
.new(user: current_user)
.call(params.with_indifferent_access)
- @ifc_model = call.result
+ @ifc_model = service_result.result
end
session.delete :pending_ifc_model_title
session.delete :pending_ifc_model_is_default
session.delete :pending_ifc_model_ifc_model_id
- if call.success?
+ if service_result.success?
::Attachments::FinishDirectUploadJob.perform_later attachment.id
if new_model
@@ -136,7 +136,7 @@ module Bim
else
attachment.destroy
- flash[:error] = call.errors.full_messages.join(" ")
+ flash[:error] = service_result.errors.full_messages.join(" ")
redirect_to action: :new
end
@@ -147,17 +147,17 @@ module Bim
.to_h
.reverse_merge(project: @project)
- call = ::Bim::IfcModels::CreateService
+ service_result = ::Bim::IfcModels::CreateService
.new(user: current_user)
.call(combined_params)
- @ifc_model = call.result
+ @ifc_model = service_result.result
- if call.success?
+ if service_result.success?
flash[:notice] = t('ifc_models.flash_messages.upload_successful')
redirect_to action: :index
else
- @errors = call.errors
+ @errors = service_result.errors
render action: :new
end
end
@@ -167,17 +167,17 @@ module Bim
.to_h
.reverse_merge(project: @project)
- call = ::Bim::IfcModels::UpdateService
+ service_result = ::Bim::IfcModels::UpdateService
.new(user: current_user, model: @ifc_model)
.call(combined_params)
- @ifc_model = call.result
+ @ifc_model = service_result.result
- if call.success?
+ if service_result.success?
flash[:notice] = t(:notice_successful_update)
redirect_to action: :index
else
- @errors = call.errors
+ @errors = service_result.errors
render action: :edit
end
end
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 d3f66fed662..a3f9258ac67 100644
--- a/modules/bim/app/services/bim/ifc_models/update_service.rb
+++ b/modules/bim/app/services/bim/ifc_models/update_service.rb
@@ -32,23 +32,23 @@ module Bim
protected
def before_perform(params)
- super.tap do |call|
- @ifc_attachment_replaced = call.success? && model.ifc_attachment.new_record?
+ super.tap do |_service_result|
+ @ifc_attachment_replaced = model.ifc_attachment.new_record?
end
end
- def after_perform(call)
- if call.success?
+ def after_perform(service_result)
+ if service_result.success?
# As the attachments association does not have the autosave option, we need to remove the
# attachments ourselves
model.attachments.select(&:marked_for_destruction?).each(&:destroy)
if @ifc_attachment_replaced
- IfcConversionJob.perform_later(call.result)
+ IfcConversionJob.perform_later(service_result.result)
end
end
- call
+ service_result
end
end
end