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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#66093] Do not hardcode `customized_type` in API
Tobias Dillmannba9eb9b830ac
diff --git a/lib/api/v3/utilities/custom_field_injector.rb b/lib/api/v3/utilities/custom_field_injector.rbindex 23c19b1d84b..2d81b66cee3 100644--- a/lib/api/v3/utilities/custom_field_injector.rb+++ b/lib/api/v3/utilities/custom_field_injector.rb@@ -312,7 +312,7 @@ module APInext unless custom_field.calculated_value?next unless available_custom_fields.include?(custom_field)- errors = custom_field.calculated_value_errors.where(customized_id: id, customized_type: "Project")+ errors = custom_field.calculated_value_errors.where(customized: self)errors.map do |err|{ code: err.error_code,message: CalculatedValues::ErrorsHelper.calculated_value_error_msg(err) }diff --git a/spec/lib/api/v3/projects/project_representer_rendering_spec.rb b/spec/lib/api/v3/projects/project_representer_rendering_spec.rbindex 6d00631ebef..23b35e6782d 100644--- a/spec/lib/api/v3/projects/project_representer_rendering_spec.rb+++ b/spec/lib/api/v3/projects/project_representer_rendering_spec.rb@@ -226,7 +226,7 @@ RSpec.describe API::V3::Projects::ProjectRepresenter, "rendering" dobefore dovalue_errors_double = doubleallow(value_errors_double).to receive(:where)- .with(customized_id: project.id, customized_type: "Project")+ .with(customized: project).and_return([calculated_value_error])allow(calculated_value_custom_field).to receive(:calculated_value_errors)