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

Add comment about the attributes_by_timestamp method usage.

Dombi Attila6c25c776e74d
diff --git a/app/models/journable/with_historic_attributes.rb b/app/models/journable/with_historic_attributes.rb
index a9565217123..372de13f2e9 100644
--- a/app/models/journable/with_historic_attributes.rb
+++ b/app/models/journable/with_historic_attributes.rb
@@ -132,7 +132,11 @@ class Journable::WithHistoricAttributes < SimpleDelegator
end
end
end
- # TODO: Add comment that this is not being used for the API.
+
+ # The `attributes_by_timestamp` method is not being directly used in the api to render the
+ # attributesByTimestamp object inside the historic work packages.
+ # It serves as a console tool at the moment.
+
def attributes_by_timestamp
@attributes_by_timestamp ||= Hash.new do |h, t|
attributes = if include_only_changed_attributes
diff --git a/spec/models/journable/with_historic_attributes_spec.rb b/spec/models/journable/with_historic_attributes_spec.rb
index 6ab328a3bd0..d21f6532752 100644
--- a/spec/models/journable/with_historic_attributes_spec.rb
+++ b/spec/models/journable/with_historic_attributes_spec.rb
@@ -638,7 +638,7 @@ RSpec.describe Journable::WithHistoricAttributes,
end
context 'for a timestamp where the work package did not exist' do
- it 'returns the changed attributes at the timestamp compared to the current attribute values' do
+ it 'returns no changes' do
expect(subject.changed_at_timestamp(Timestamp.parse("2021-01-01T00:00:00Z")))
.to be_empty
end