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

[#43393] [AppSignal] ActionView::Template::Error date out of range for timestamp

Dombi Attilaa840322fb8fa
diff --git a/modules/reporting/lib/report/operator.rb b/modules/reporting/lib/report/operator.rb
index 17953dbad60..cb9753fa12c 100644
--- a/modules/reporting/lib/report/operator.rb
+++ b/modules/reporting/lib/report/operator.rb
@@ -91,7 +91,7 @@ class Report::Operator
new '!', label: :label_not_equals do
def modify(query, field, *values)
where_clause = "(#{field} IS NULL"
- where_clause += " OR #{field} NOT IN #{collection(*values)}" unless values.compact.empty?
+ where_clause += " OR #{field} NOT IN #{collection(*values)}" unless values.all?(&:blank?)
where_clause += ')'
query.where where_clause
query
@@ -117,7 +117,7 @@ class Report::Operator
def modify(query, field, *values)
if values.size == 1 && values.first.nil?
query.where "#{field} IS NULL"
- elsif values.compact.empty?
+ elsif values.all?(&:blank?)
query.where '1=0'
else
query.where "#{field} IN #{collection(*values)}"
diff --git a/modules/reporting/spec/models/cost_query/operator_spec.rb b/modules/reporting/spec/models/cost_query/operator_spec.rb
index 330e5b45210..6233da23b1d 100644
--- a/modules/reporting/spec/models/cost_query/operator_spec.rb
+++ b/modules/reporting/spec/models/cost_query/operator_spec.rb
@@ -71,6 +71,10 @@ describe CostQuery, type: :model, reporting_query_helper: true do
expect(query('projects', 'id', '=', nil).size).to eq(0)
end
+ it "does = for empty string" do
+ expect(query('projects', 'id', '=', '').size).to eq(0)
+ end
+
it "does <=" do
expect(query('projects', 'id', '<=', project2.id - 1).size).to eq(1)
end
@@ -83,6 +87,10 @@ describe CostQuery, type: :model, reporting_query_helper: true do
expect(query('projects', 'id', '!', project1.id).size).to eq(1)
end
+ it "does ! for empty string" do
+ expect(query('projects', 'id', '!', '').size).to eq(0)
+ end
+
it "does ! for multiple values" do
expect(query('projects', 'id', '!', project1.id, project2.id).size).to eq(0)
end