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

[#54966] Saturday missing in "My spent time" widget in "My page"

Dombi Attila07d9fb35e53c
diff --git a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/services/configuration-modal/configuration-modal.service.ts b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/services/configuration-modal/configuration-modal.service.ts
index da282cb14b6..43fcd2de996 100644
--- a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/services/configuration-modal/configuration-modal.service.ts
+++ b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/services/configuration-modal/configuration-modal.service.ts
@@ -25,8 +25,9 @@ export class TimeEntriesCurrentUserConfigurationModalService {
// offsetToApply = -1, so we need to pass the last daysCheckedValues to the start of the array to match the localeWeekDays order
// In order save the result, we will have to reorder it with offset 1 (getCheckedValuesInOriginalOrder)
const offsetToApply = localeOffset - 1;
- const offsetCheckedValues = offsetToApply >= 0 ? daysCheckedValues.splice(0, offsetToApply) : daysCheckedValues.splice(offsetToApply);
- const orderedDaysCheckedValues = offsetToApply >= 0 ? [...daysCheckedValues, ...offsetCheckedValues] : [...offsetCheckedValues, ...daysCheckedValues];
+ const checkedValues = Array.from(daysCheckedValues);
+ const offsetCheckedValues = offsetToApply >= 0 ? checkedValues.splice(0, offsetToApply) : checkedValues.splice(offsetToApply);
+ const orderedDaysCheckedValues = offsetToApply >= 0 ? [...checkedValues, ...offsetCheckedValues] : [...offsetCheckedValues, ...checkedValues];
const weekDaysWithCheckedValue = orderedDaysCheckedValues
.map(
(dayCheckedValue, index) => ({
@@ -61,7 +62,7 @@ export class TimeEntriesCurrentUserConfigurationModalService {
private validDays(days:DisplayedDays) {
if (days.every((value) => !value)) {
- return Array.apply(null, Array(7)).map(() => true);
+ return Array.from({ length: 7 }, () => true);
}
return days;
}
diff --git a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
index e7f1e5727bd..1414bc0a200 100644
--- a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
+++ b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
@@ -277,6 +277,16 @@ RSpec.describe "My page time entries current user widget spec", :js do
expect(page)
.to have_content "Total: 13 h"
+ ## Opening the configuration modal multiple times (Regression#54966)
+ entries_area.click_menu_item I18n.t("js.grid.configure")
+ click_on "Cancel"
+ entries_area.click_menu_item I18n.t("js.grid.configure")
+
+ ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"].each do |day_name|
+ expect(page).to have_field(day_name, checked: true)
+ end
+ click_on "Cancel"
+
## Hiding weekdays
entries_area.click_menu_item I18n.t("js.grid.configure")