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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
baseline api: rename `matches_query_at_timestamps` to `matches_query_filters_at_timestamps`
Sebastian Fiedlschuster969f50fc46c4
diff --git a/app/models/journable/with_historic_attributes.rb b/app/models/journable/with_historic_attributes.rbindex 357c9d0cb1e..82e53104c5c 100644--- a/app/models/journable/with_historic_attributes.rb+++ b/app/models/journable/with_historic_attributes.rb@@ -50,7 +50,7 @@# # Check at which timestamps the work package matches query filters after wrapping# query.timestamps # => [<Timestamp 2022-01-01T00:00:00Z>, <Timestamp PT0S>]# work_package = Journable::WithHistoricAttributes.wrap(work_package, query:)-# work_package.matches_query_at_timestamps # => [<Timestamp 2022-01-01T00:00:00Z>]+# work_package.matches_query_filters_at_timestamps # => [<Timestamp 2022-01-01T00:00:00Z>]## # Include only changed attributes in payload# # i.e. only historic attributes that differ from the work_package's attributes@@ -70,7 +70,7 @@# work_package.subject # => "Subject at PT0S (current time)"#class Journable::WithHistoricAttributes < SimpleDelegator- attr_accessor :timestamps, :query, :include_only_changed_attributes, :attributes_by_timestamp, :matches_query_at_timestamps+ attr_accessor :timestamps, :query, :include_only_changed_attributes, :attributes_by_timestamp, :matches_query_filters_at_timestampsdef initialize(journable, timestamps: nil, query: nil, include_only_changed_attributes: false)super(journable)@@ -86,7 +86,7 @@ class Journable::WithHistoricAttributes < SimpleDelegatorself.include_only_changed_attributes = include_only_changed_attributesself.attributes_by_timestamp = {}- self.matches_query_at_timestamps = []+ self.matches_query_filters_at_timestamps = []enddef self.wrap(journable_or_journables, timestamps: nil, query: nil, include_only_changed_attributes: false)@@ -130,7 +130,7 @@ class Journable::WithHistoricAttributes < SimpleDelegatordef assign_historic_attributes(timestamp:, historic_journable:, matching_journable:)attributes_by_timestamp[timestamp.to_s] = extract_historic_attributes_from(historic_journable:) if historic_journable- matches_query_at_timestamps << timestamp if matching_journable+ matches_query_filters_at_timestamps << timestamp if matching_journableenddef self.assign_historic_attributes_to(journables, timestamp:, historic_journables:, matching_journables:, query:)@@ -187,7 +187,7 @@ class Journable::WithHistoricAttributes < SimpleDelegatorenddef matches_query_filter_at_baseline_timestamp?- query && matches_query_at_timestamps.include?(baseline_timestamp)+ query && matches_query_filters_at_timestamps.include?(baseline_timestamp)enddef current_timestamp@@ -195,11 +195,11 @@ class Journable::WithHistoricAttributes < SimpleDelegatorenddef matches_query_filter_at_current_timestamp?- query && matches_query_at_timestamps.include?(current_timestamp)+ query && matches_query_filters_at_timestamps.include?(current_timestamp)enddef matches_query_filter_at_timestamp?(timestamp)- query && matches_query_at_timestamps.include?(timestamp)+ query && matches_query_filters_at_timestamps.include?(timestamp)enddef self.query_work_packages(query:, timestamp: nil)diff --git a/lib/api/v3/work_packages/eager_loading/historic_attributes.rb b/lib/api/v3/work_packages/eager_loading/historic_attributes.rbindex 4eeb4702542..ad336644731 100644--- a/lib/api/v3/work_packages/eager_loading/historic_attributes.rb+++ b/lib/api/v3/work_packages/eager_loading/historic_attributes.rb@@ -37,9 +37,7 @@ module API::V3::WorkPackages::EagerLoadingwork_package.attributes_by_timestamp = work_package_with_historic_attributes.attributes_by_timestampwork_package.baseline_timestamp = work_package_with_historic_attributes.baseline_timestampwork_package.matches_query_filter_at_baseline_timestamp = work_package_with_historic_attributes.matches_query_filter_at_baseline_timestamp?- work_package.matches_query_at_timestamps = work_package_with_historic_attributes.matches_query_at_timestamps-- # TODO: rename `matches_query_at_timestamps` to `matches_query_filters_at_timestamps`?+ work_package.matches_query_filters_at_timestamps = work_package_with_historic_attributes.matches_query_filters_at_timestampsenddef self.module@@ -63,21 +61,21 @@ module API::V3::WorkPackages::EagerLoadingincluded doattr_accessor :baseline_attributes, :attributes_by_timestamp, :baseline_timestamp,:matches_query_filter_at_baseline_timestamp,- :matches_query_at_timestamps+ :matches_query_filters_at_timestampsend# Does the work package match the query filter at the baseline timestamp?# Returns `nil` if no query is given.#def matches_query_filter_at_baseline_timestamp?- matches_query_at_timestamps.any? ? matches_query_filter_at_baseline_timestamp : nil+ matches_query_filters_at_timestamps.any? ? matches_query_filter_at_baseline_timestamp : nilend# Does the work package match the query filter at the given timestamp?# Returns `nil` if no query is given.#def matches_query_filter_at_timestamp?(timestamp)- matches_query_at_timestamps.any? ? matches_query_at_timestamps.include?(timestamp) : nil+ matches_query_filters_at_timestamps.any? ? matches_query_filters_at_timestamps.include?(timestamp) : nilendendenddiff --git a/spec/models/journable/with_historic_attributes_spec.rb b/spec/models/journable/with_historic_attributes_spec.rbindex 17c5170a48d..f815c4997c5 100644--- a/spec/models/journable/with_historic_attributes_spec.rb+++ b/spec/models/journable/with_historic_attributes_spec.rb@@ -107,8 +107,8 @@ describe Journable::WithHistoricAttributes dolet(:search_term) { "original" }it "determines for each timestamp whether the journable matches the query at that timestamp" do- expect(subject.matches_query_at_timestamps).to include Timestamp.parse("2022-01-01T00:00:00Z")- expect(subject.matches_query_at_timestamps).not_to include Timestamp.parse("PT0S")+ expect(subject.matches_query_filters_at_timestamps).to include Timestamp.parse("2022-01-01T00:00:00Z")+ expect(subject.matches_query_filters_at_timestamps).not_to include Timestamp.parse("PT0S")endend@@ -188,8 +188,8 @@ describe Journable::WithHistoricAttributes dolet(:search_term) { "original" }it "determines for each timestamp whether the journables matches the query at that timestamp" do- expect(subject.first.matches_query_at_timestamps).to include Timestamp.parse("2022-01-01T00:00:00Z")- expect(subject.first.matches_query_at_timestamps).not_to include Timestamp.parse("PT0S")+ expect(subject.first.matches_query_filters_at_timestamps).to include Timestamp.parse("2022-01-01T00:00:00Z")+ expect(subject.first.matches_query_filters_at_timestamps).not_to include Timestamp.parse("PT0S")endend