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

`Query::Results`: always return current, non-historic work-package data

Sebastian Fiedlschuster55c10f5e93eb
diff --git a/app/models/query/results.rb b/app/models/query/results.rb
index a4e491ebef6..b1835dc4824 100644
--- a/app/models/query/results.rb
+++ b/app/models/query/results.rb
@@ -51,7 +51,6 @@ class ::Query::Results
.order(order_option)
.references(:projects)
.order(sort_criteria_array)
- #.at_timestamp(query.timestamps.last)
end
def work_package_ids
diff --git a/spec/models/query/results_filter_on_historic_data_spec.rb b/spec/models/query/results_filter_on_historic_data_spec.rb
index ae0208951ed..383a7cae8f5 100644
--- a/spec/models/query/results_filter_on_historic_data_spec.rb
+++ b/spec/models/query/results_filter_on_historic_data_spec.rb
@@ -123,9 +123,17 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
it "includes the work package matching in the past" do
expect(subject).to include work_package
end
-
- it "returns the work packages in their historic state" do
- expect(subject.first.description).to eq "This is the original description of the work package"
+
+ it "returns the work packages in their current state" do
+ expect(subject.first.description).to eq "This is the current description of the work package"
+ end
+
+ describe "when chaining at_timestamp" do
+ subject { WorkPackage.at_timestamp(historic_time).where(id: results.work_packages.pluck(:id)) }
+
+ it "returns the work packages in their historic states" do
+ expect(subject.first.description).to eq "This is the original description of the work package"
+ end
end
end
end