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

disambigute value in summable_select_statement

Ivan Kuchin924e9c89e284
diff --git a/app/models/queries/work_packages/selects/custom_field_select.rb b/app/models/queries/work_packages/selects/custom_field_select.rb
index 28bc7339397..8f4520d4f2a 100644
--- a/app/models/queries/work_packages/selects/custom_field_select.rb
+++ b/app/models/queries/work_packages/selects/custom_field_select.rb
@@ -77,9 +77,9 @@ class Queries::WorkPackages::Selects::CustomFieldSelect < Queries::WorkPackages:
def summable_select_statement
if custom_field.field_format == "int"
- "COALESCE(SUM(value::BIGINT)::BIGINT, 0) #{name}"
+ "COALESCE(SUM(#{CustomValue.quoted_table_name}.value::BIGINT)::BIGINT, 0) #{name}"
else
- "COALESCE(ROUND(SUM(value::NUMERIC), 2)::FLOAT, 0.0) #{name}"
+ "COALESCE(ROUND(SUM(#{CustomValue.quoted_table_name}.value::NUMERIC), 2)::FLOAT, 0.0) #{name}"
end
end