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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Extract build local times into method
Oliver Güntherb5912b82e4f5
diff --git a/app/models/users/scopes/having_reminder_mail_to_send.rb b/app/models/users/scopes/having_reminder_mail_to_send.rbindex a724216574a..6240d22ba3c 100644--- a/app/models/users/scopes/having_reminder_mail_to_send.rb+++ b/app/models/users/scopes/having_reminder_mail_to_send.rb@@ -126,34 +126,35 @@ module Users::Scopesdef times_for_zones(times)UserPreferences::UpdateContract.assignable_time_zones- .map do |z|- times.map do |time|- local_time = time.in_time_zone(z)-- # Get the iso weekday of the current time to check- # which users have it enabled as a workday- workday = local_time.to_date.cwday-- # Get the corresponding "UTC" date by conversion- # to compare them with pause_reminder dates which are derived from UTC- utc_date = local_time.utc.to_date-- # Since only full hours can be configured, we can disregard any local time that is not- # a full hour.- next if local_time.min != 0-- [- utc_date,- local_time.strftime('%H:00:00+00:00'),- z.tzinfo.canonical_zone.name,- workday- ]- end- end- .flatten(1)+ .flat_map { |zone| build_local_times(times, zone) }.compactend+ def build_local_times(times, zone)+ times.map do |time|+ local_time = time.in_time_zone(zone)++ # Get the iso weekday of the current time to check+ # which users have it enabled as a workday+ workday = local_time.to_date.cwday++ # Get the corresponding "UTC" date by conversion+ # to compare them with pause_reminder dates which are derived from UTC+ utc_date = local_time.utc.to_date++ # Since only full hours can be configured, we can disregard any local time that is not+ # a full hour.+ next if local_time.min != 0++ [+ utc_date,+ local_time.strftime('%H:00:00+00:00'),+ zone.tzinfo.canonical_zone.name,+ workday+ ]+ end+ end+def quarters_between_earliest_and_now(earliest_time)latest_time = Time.currentraise ArgumentError if latest_time < earliest_time || (latest_time - earliest_time) > 1.day