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

Merge https://github.com/opf/openproject/pull/11243 into https://github.com/opf/openproject/pull/11678

Sebastian Fiedlschuster1181bde276a7
diff --cc app/models/journal/timestamps.rb
index eb75702ddd6,00f9c944d88..56df58db676
--- a/app/models/journal/timestamps.rb
+++ b/app/models/journal/timestamps.rb
@@@ -50,16 -63,17 +63,18 @@@ module Journal::Timestamp
# a journable at a given timestamp.
#
def at_timestamp(timestamp)
- raise ArgumentError, "Expected timestamp to be a Timestamp, an ActiveSupport::TimeWithZone, or a DateTime" unless timestamp.kind_of? Timestamp or timestamp.kind_of? ActiveSupport::TimeWithZone or timestamp.kind_of? DateTime
- unless timestamp.kind_of? ActiveSupport::TimeWithZone or timestamp.kind_of? DateTime
- raise ArgumentError, "Expected timestamp to be an ActiveSupport::TimeWithZone or DateTime"
++ unless timestamp.kind_of? Timestamp or timestamp.kind_of? ActiveSupport::TimeWithZone or timestamp.kind_of? DateTime
++ raise ArgumentError, "Expected timestamp to be a Timestamp, an ActiveSupport::TimeWithZone, or a DateTime"
+ end
+
+ timestamp = timestamp.to_time if timestamp.kind_of? Timestamp
timestamp = timestamp.in_time_zone if timestamp.kind_of? DateTime
- where(id:
- where(created_at: (..timestamp)) \
- .select("distinct on (journable_type, journable_id) id") \
- .reorder(:journable_type, :journable_id, created_at: :desc)
- )
+ where(id: where(created_at: (..timestamp)) \
+ .select("distinct on (journable_type, journable_id) id") \
+ .reorder(:journable_type, :journable_id, created_at: :desc))
end
-
end
end
+
+ # rubocop:enable Style/ClassCheck