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: rubocop refactoring

Sebastian Fiedlschuster547711b7dd29
diff --git a/app/models/journable/with_historic_attributes.rb b/app/models/journable/with_historic_attributes.rb
index a8625522c31..50bc7948adf 100644
--- a/app/models/journable/with_historic_attributes.rb
+++ b/app/models/journable/with_historic_attributes.rb
@@ -114,6 +114,7 @@ class Journable::WithHistoricAttributes < SimpleDelegator
journable
end
+ # rubocop:disable Metrics/AbcSize
def self.wrap_multiple(journables, timestamps: nil, query: nil, include_only_changed_attributes: false)
timestamps ||= query.try(:timestamps) || []
journables = journables.first.class.at_timestamp(timestamps.last).where(id: journables) if timestamps.last.try(:historic?)
@@ -129,6 +130,7 @@ class Journable::WithHistoricAttributes < SimpleDelegator
end
journables
end
+ # rubocop:enable Metrics/AbcSize
def assign_historic_attributes(timestamp:, historic_journable:, matching_journable:)
attributes_by_timestamp[timestamp.to_s] = extract_historic_attributes_from(historic_journable:) if historic_journable
diff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rb
index b38e2805826..e642d403263 100644
--- a/lib/api/v3/work_packages/work_package_representer.rb
+++ b/lib/api/v3/work_packages/work_package_representer.rb
@@ -480,7 +480,9 @@ module API
property :attributes_by_timestamp,
as: :attributesByTimestamp,
- if: ->(*) { respond_to?(:attributes_by_timestamp) and respond_to?(:timestamps) and timestamps != [Timestamp.now] },
+ if: ->(*) {
+ respond_to?(:attributes_by_timestamp) and respond_to?(:timestamps) and timestamps != [Timestamp.now]
+ },
getter: ->(*) do
timestamps.collect do |timestamp|
attrs = attributes_by_timestamp[timestamp.to_s].to_h