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

baseline api: pass timestamps to query

Sebastian Fiedlschusterffca847e65c8
diff --git a/app/services/update_query_from_params_service.rb b/app/services/update_query_from_params_service.rb
index e91f4e111f5..623656b7efa 100644
--- a/app/services/update_query_from_params_service.rb
+++ b/app/services/update_query_from_params_service.rb
@@ -53,6 +53,8 @@ class UpdateQueryFromParamsService
apply_include_subprojects(params)
+ apply_timestamps(params)
+
disable_hierarchy_when_only_grouped_by(params)
if valid_subset
@@ -117,6 +119,10 @@ class UpdateQueryFromParamsService
query.include_subprojects = params[:include_subprojects] if params.key?(:include_subprojects)
end
+ def apply_timestamps(params)
+ query.timestamps = params[:timestamps] if params.key?(:timestamps)
+ end
+
def disable_hierarchy_when_only_grouped_by(params)
if params.key?(:group_by) && !params.key?(:show_hierarchies)
query.show_hierarchies = false
diff --git a/spec/services/update_query_from_params_service_spec.rb b/spec/services/update_query_from_params_service_spec.rb
index 728b3d14a80..7c2a052669e 100644
--- a/spec/services/update_query_from_params_service_spec.rb
+++ b/spec/services/update_query_from_params_service_spec.rb
@@ -190,5 +190,16 @@ describe UpdateQueryFromParamsService,
end
end
end
+
+ context "timestamps" do
+ let(:timestamps) { [Timestamp.parse("2022-10-29T23:01:23Z"), Timestamp.parse("P-0Y")] }
+ let(:params) { { timestamps: } }
+
+ it 'sets the timestamps' do
+ subject
+
+ expect(query.timestamps).to eq timestamps
+ end
+ end
end
end