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

Call distinct on WorkPackageCustomField

Oliver Günther47445d5d5bd7
diff --git a/app/services/projects/set_attributes_service.rb b/app/services/projects/set_attributes_service.rb
index da159d57361..6336539c163 100644
--- a/app/services/projects/set_attributes_service.rb
+++ b/app/services/projects/set_attributes_service.rb
@@ -65,7 +65,10 @@ module Projects
def set_default_active_work_package_custom_fields(provided)
return if provided
- model.work_package_custom_fields = WorkPackageCustomField.joins(:types).where(types: { id: model.type_ids })
+ model.work_package_custom_fields = WorkPackageCustomField
+ .joins(:types)
+ .where(types: { id: model.type_ids })
+ .distinct
end
def update_status(attributes)