-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[59539] Make work packages manually scheduled by default
The `schedule_manually` column is also non-nullable now. This includes the following changes: - Automatically scheduled parent dates are and `ignore_non_working_days` attributes are now always derived from children's values, even if the children are scheduled manually. It's more natural. Without that, adding a child to a work package would not change the parent's dates. As a consequence, the parent can start on a non-working day if one of its children is manually scheduled, ignores non-working days, and starts on a non-working day. That's why the parent's `ignore_non_working_days` attribute is now also derived from all its children regardless of the scheduling mode. If the parent is manually scheduled, its dates and it's ability to ignore non-working days will still be defined independently from its children. - Fix tests broken by scheduling mode being manual by default. The tests had to be adapted to explicitly set scheduling mode to automatic for followers and parents, and sometimes even follower's children. Without it, work packages would not be rescheduled automatically. - Replace schedule helpers with table helpers. Schedule helpers helped well, but table helpers are more flexible and support more column types. - Add "days counting" and "scheduling mode" columns to table helpers. "days counting" to set `ignore_non_working_days` attribute. - "all days" value maps to `ignore_non_working_days: true`. - "working days" value maps to `ignore_non_working_days: false`. "scheduling mode" to set `schedule_manually` attribute. - "manual" value maps to `schedule_manually: true`. - "automatic" value maps to `schedule_manually: false`.
- Loading branch information
Showing
46 changed files
with
1,924 additions
and
3,111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
db/migrate/20241120095318_update_scheduling_mode_and_lags.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
class UpdateSchedulingModeAndLags < ActiveRecord::Migration[7.1] | ||
def up | ||
change_column_default :work_packages, :schedule_manually, from: false, to: true | ||
execute "UPDATE work_packages SET schedule_manually = false WHERE schedule_manually IS NULL" | ||
change_column_null :work_packages, :schedule_manually, false | ||
|
||
migration_job = WorkPackages::AutomaticMode::MigrateValuesJob | ||
if Rails.env.development? | ||
migration_job.perform_now | ||
else | ||
migration_job.perform_later | ||
end | ||
end | ||
|
||
def down | ||
change_column_default :work_packages, :schedule_manually, from: true, to: false | ||
# Keep the not-null constraint when rolling back | ||
change_column_null :work_packages, :schedule_manually, false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.