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

ensure proper translation of day names

ulferts0e6278e43a00
diff --git a/app/services/work_packages/shared/working_days.rb b/app/services/work_packages/shared/working_days.rb
index 40aa6dbbfb7..8dc756ba6a1 100644
--- a/app/services/work_packages/shared/working_days.rb
+++ b/app/services/work_packages/shared/working_days.rb
@@ -121,7 +121,7 @@ module WorkPackages
# WeekDay day of the week is stored as ISO, meaning Monday is 1 and Sunday is 7.
# Ruby Date#wday value for Sunday is 0 and it goes until 6 Saturday.
- # To accomodate both versions 0-6, 1-7, an array of 8 elements is created
+ # To accommodate both versions 0-6, 1-7, an array of 8 elements is created
# where array[0] = array[7] = value for Sunday
#
# Since Setting.working_days can be empty, the initial array is
diff --git a/app/workers/work_packages/apply_working_days_change_job.rb b/app/workers/work_packages/apply_working_days_change_job.rb
index 4a087e60603..5c91f18aa8e 100644
--- a/app/workers/work_packages/apply_working_days_change_job.rb
+++ b/app/workers/work_packages/apply_working_days_change_job.rb
@@ -117,7 +117,7 @@ class WorkPackages::ApplyWorkingDaysChangeJob < ApplicationJob
def working_day_change_message(day, working)
I18n.t(:"working_days.journal_note.days.#{working ? :working : :non_working}",
- day: I18n.t('date.day_names')[day])
+ day: WeekDay.find_by!(day:).name)
end
def for_each_work_package_in_scope(scope)
diff --git a/spec/workers/work_packages/apply_working_days_change_job_spec.rb b/spec/workers/work_packages/apply_working_days_change_job_spec.rb
index 92a7f59ad39..96c34f2ef86 100644
--- a/spec/workers/work_packages/apply_working_days_change_job_spec.rb
+++ b/spec/workers/work_packages/apply_working_days_change_job_spec.rb
@@ -551,4 +551,25 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob do
end
end
end
+
+ context 'when turning Sunday into a non working day' do
+ let_schedule(<<~CHART)
+ days | MTWTFSSm |
+ work_package | X▓▓X |
+ CHART
+
+ before do
+ set_working_week_days('Sunday')
+ end
+
+ # Not interested in the scheduling changes in this spec
+ it_behaves_like 'journal updates with note' do
+ let(:changed_work_packages) do
+ [work_package]
+ end
+ let(:journal_notice) do
+ "**Working days** changed (Sunday is now working)."
+ end
+ end
+ end
end