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

safeguard against large time differences

ulfertsfff18d0e3157
diff --git a/app/models/users/scopes/having_reminder_mail_to_send.rb b/app/models/users/scopes/having_reminder_mail_to_send.rb
index 14aab6442b0..a64b0ff78e8 100644
--- a/app/models/users/scopes/having_reminder_mail_to_send.rb
+++ b/app/models/users/scopes/having_reminder_mail_to_send.rb
@@ -104,7 +104,7 @@ module Users::Scopes
def hours_between_earliest_and_now(earliest_time)
raise ArgumentError if Time.current - earliest_time < 0
- (0..(((Time.current - earliest_time) / 1.hour).round)).map do |i|
+ (0..[((Time.current - earliest_time) / 1.hour).round, 24].min).map do |i|
(earliest_time + i.hours).utc
end
end