Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code maintenance/60655 bump ruby to 341 #17651

Merged
merged 7 commits into from
Jan 27, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adapt to changes in ranges in 3.4.1
ulferts committed Jan 23, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 0155c22aded002ba58c508cf3d26750cb0795cc0
9 changes: 7 additions & 2 deletions app/models/users/scopes/having_reminder_mail_to_send.rb
Original file line number Diff line number Diff line change
@@ -183,8 +183,13 @@ def quarters_between_earliest_and_latest(earliest_time, latest_time) # rubocop:d
# The last quarter is the one smaller than the latest time. But needs to be at least equal to the first quarter.
last_quarter = [first_quarter, latest_time.change(min: latest_time.min / 15 * 15)].max

(first_quarter.to_i..last_quarter.to_i)
.step(15.minutes)
quarters = if first_quarter == last_quarter
[first_quarter]
else
(first_quarter.to_i..last_quarter.to_i).step(15.minutes)
end

quarters
.map do |time|
Time.zone.at(time)
end
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ class ScheduleDateAlertsNotificationsJob < ApplicationJob
def perform
return unless EnterpriseToken.allows_to?(:date_alerts)

Service.new(every_quater_hour_between_predecessor_cron_at_and_own_cron_at).call
Service.new(every_quarter_hour_between_predecessor_cron_at_and_own_cron_at).call
end

# What cannot be controlled is the time at which a job is actually performed.
@@ -70,9 +70,14 @@ def perform
# for 1:00 am local time are covered. The sole exception would be the case where previously finished jobs
# have been removed from the database and the current job took longer to start executing. This is for now
# an accepted shortcoming as the likelihood of this happening is considered to be very low.
def every_quater_hour_between_predecessor_cron_at_and_own_cron_at
(lower_boundary.to_i..upper_boundary.to_i)
.step(15.minutes)
def every_quarter_hour_between_predecessor_cron_at_and_own_cron_at
quarters = (lower_boundary.to_i..upper_boundary.to_i).step(15.minutes).to_a

if quarters.empty? && lower_boundary.present?
quarters = [lower_boundary]
end

quarters
.map do |time|
Time.zone.at(time)
end
4 changes: 2 additions & 2 deletions spec/models/users/scopes/having_reminder_mail_to_send_spec.rb
Original file line number Diff line number Diff line change
@@ -380,7 +380,7 @@
)
end
let(:scope_upper_boundary_time) { ActiveSupport::TimeZone["Europe/Paris"].parse("2021-09-30T08:09").utc }
let(:scope_lower_boundary_time) { ActiveSupport::TimeZone["Europe/Paris"].parse("2021-09-30T08:00") }
let(:scope_lower_boundary_time) { ActiveSupport::TimeZone["Europe/Paris"].parse("2021-09-30T08:00").utc }

it "contains the user" do
expect(scope)
@@ -399,7 +399,7 @@
)
end
let(:scope_upper_boundary_time) { ActiveSupport::TimeZone["Europe/Paris"].parse("2021-09-30T10:00").utc }
let(:scope_lower_boundary_time) { ActiveSupport::TimeZone["Europe/Paris"].parse("2021-09-30T10:00") }
let(:scope_lower_boundary_time) { ActiveSupport::TimeZone["Europe/Paris"].parse("2021-09-30T10:00").utc }

it "is empty" do
expect(scope)