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 update cost report spec by casting IDs to integers before checking for equality

Benjamin Bädorf29916b18091e
diff --git a/modules/reporting/lib/widget/filters/project.rb b/modules/reporting/lib/widget/filters/project.rb
index 65215f00ce4..b449d35afb9 100644
--- a/modules/reporting/lib/widget/filters/project.rb
+++ b/modules/reporting/lib/widget/filters/project.rb
@@ -37,11 +37,14 @@ class Widget::Filters::Project < Widget::Filters::Base
selected_values = filter.values.each.map do |id|
- available_value = filter_class.available_values.detect { |val| val[1] === id }
+ # When live testing, these IDs came out as integers.
+ # However, when running the specs, they came out as strings.
+ int_id = Integer(id)
+ available_value = filter_class.available_values.detect { |val| Integer(val[1]) === int_id }
if available_value != nil
{
- id: id,
+ id: int_id,
name: available_value[0]
}
else