diff --git a/app/contracts/relations/base_contract.rb b/app/contracts/relations/base_contract.rb index 2a1ddc9d7056..24b9b23e0ce5 100644 --- a/app/contracts/relations/base_contract.rb +++ b/app/contracts/relations/base_contract.rb @@ -29,7 +29,7 @@ module Relations class BaseContract < ::ModelContract attribute :relation_type - attribute :delay + attribute :lag attribute :description attribute :from attribute :to diff --git a/app/models/relation.rb b/app/models/relation.rb index 377fae809f4a..a39f733dad75 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -100,10 +100,10 @@ class Relation < ApplicationRecord scope :of_work_package, ->(work_package) { where(from: work_package).or(where(to: work_package)) } - scope :follows_with_delay, - -> { follows.where("delay > 0") } + scope :follows_with_lag, + -> { follows.where("lag > 0") } - validates :delay, numericality: { allow_nil: true } + validates :lag, numericality: { allow_nil: true } validates :to, uniqueness: { scope: :from } @@ -138,7 +138,7 @@ def successor_soonest_start if follows? && (to.start_date || to.due_date) days = WorkPackages::Shared::Days.for(from) relation_start_date = (to.due_date || to.start_date) + 1.day - days.soonest_working_day(relation_start_date, delay:) + days.soonest_working_day(relation_start_date, lag:) end end @@ -146,13 +146,6 @@ def <=>(other) TYPES[relation_type][:order] <=> TYPES[other.relation_type][:order] end - # delay is an attribute of Relation but its getter is masked by delayed_job's #delay method - # here we overwrite dj's delay method with the one reading the attribute - # since we don't plan to use dj with Relation objects, this should be fine - def delay - self[:delay] - end - TYPES.each_key do |type| define_method :"#{type}?" do canonical_type == self.class.canonical_type(type) diff --git a/app/models/work_package/scheduling_rules.rb b/app/models/work_package/scheduling_rules.rb index f236c9008da7..6b8991e78813 100644 --- a/app/models/work_package/scheduling_rules.rb +++ b/app/models/work_package/scheduling_rules.rb @@ -35,18 +35,18 @@ def schedule_automatically? # TODO: move into work package contract (possibly a module included into the contract) # Calculates the minimum date that - # will not violate the precedes relations (max(finish date, start date) + relation delay) + # will not violate the precedes relations (max(finish date, start date) + relation lag) # of this work package or its ancestors # e.g. - # AP(due_date: 2017/07/25)-precedes(delay: 0)-A - # | - # parent - # | - # BP(due_date: 2017/07/22)-precedes(delay: 2)-B - # | - # parent - # | - # CP(due_date: 2017/07/25)-precedes(delay: 2)-C + # AP(due_date: 2017/07/25)-precedes(lag: 0)-A + # | + # parent + # | + # BP(due_date: 2017/07/22)-precedes(lag: 2)-B + # | + # parent + # | + # CP(due_date: 2017/07/25)-precedes(lag: 2)-C # # Then soonest_start for: # C is 2017/07/28 diff --git a/app/services/relations/base_service.rb b/app/services/relations/base_service.rb index bffa3e24c8bd..a2da7f73b891 100644 --- a/app/services/relations/base_service.rb +++ b/app/services/relations/base_service.rb @@ -55,9 +55,9 @@ def update_relation(model, attributes) def set_defaults(model) if Relation::TYPE_FOLLOWS == model.relation_type - model.delay ||= 0 + model.lag ||= 0 else - model.delay = nil + model.lag = nil end end diff --git a/app/services/work_packages/shared/all_days.rb b/app/services/work_packages/shared/all_days.rb index 1f3a6d9e5cc6..3efe16d213b9 100644 --- a/app/services/work_packages/shared/all_days.rb +++ b/app/services/work_packages/shared/all_days.rb @@ -50,9 +50,9 @@ def due_date(start_date, duration) start_date + duration - 1 end - def soonest_working_day(date, delay: nil) - delay ||= 0 - date + delay.days if date + def soonest_working_day(date, lag: nil) + lag ||= 0 + date + lag.days if date end def working?(_date) diff --git a/app/services/work_packages/shared/working_days.rb b/app/services/work_packages/shared/working_days.rb index e11907157c91..b7c87f2a5d0a 100644 --- a/app/services/work_packages/shared/working_days.rb +++ b/app/services/work_packages/shared/working_days.rb @@ -61,13 +61,13 @@ def due_date(start_date, duration) due_date end - def soonest_working_day(date, delay: nil) + def soonest_working_day(date, lag: nil) return unless date - delay ||= 0 + lag ||= 0 - while delay > 0 - delay -= 1 if working?(date) + while lag > 0 + lag -= 1 if working?(date) date += 1 end 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 feff945dc083..bc362b92e69a 100644 --- a/app/workers/work_packages/apply_working_days_change_job.rb +++ b/app/workers/work_packages/apply_working_days_change_job.rb @@ -111,7 +111,7 @@ def changed_non_working_dates(previous_non_working_days) def applicable_predecessor(excluded) WorkPackage - .where(id: Relation.follows_with_delay.select(:to_id)) + .where(id: Relation.follows_with_lag.select(:to_id)) .where.not(id: excluded) end diff --git a/config/locales/en.yml b/config/locales/en.yml index 3bbcacf6c020..128dc24e59a5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -669,7 +669,7 @@ Project attributes and sections are defined in the = 0 | READ / WRITE | + | lag* | The number of days between closing of `from` and start of `to`| Integer | x >= 0 | READ / WRITE | \* Only applicable for some relation types such as "follows". You can check using the relation by schema endpoint at `/api/v3/relations/schema/{type}`. diff --git a/docs/release-notes/14-0-0/README.md b/docs/release-notes/14-0-0/README.md new file mode 100644 index 000000000000..b95a1b42666d --- /dev/null +++ b/docs/release-notes/14-0-0/README.md @@ -0,0 +1,214 @@ +--- +title: OpenProject 14.0.0 +sidebar_navigation: + title: 14.0.0 +release_version: 14.0.0 +release_date: 2024-04-08 +--- + +# OpenProject 14.0.0 + +Release date: 2024-04-08 + +We released [OpenProject 14.0.0](https://community.openproject.org/versions/1356). +The release contains several bug fixes and we recommend updating to the newest version. + +## Important updates and breaking changes + +### API V3: Renaming of Delay to Lag + +In the relations API, the attribute `delay` has been renamed to `lag`. +This change is to align the API with the terminology used in project management and the UI. + +For more information, see [#44054](https://community.openproject.org/work_packages/44054) + + + +## Bug fixes and changes + + + + +- Bugfix: Roadmap graph shows only work packages of current + project \[[#30865](https://community.openproject.org/wp/30865)\] +- Bugfix: Saving changes to user profile after handling error message leads to user profile instead of edit user + page \[[#36521](https://community.openproject.org/wp/36521)\] +- Bugfix: Search bar doesn't have focus state and the first element on the list seams always + selected \[[#43520](https://community.openproject.org/wp/43520)\] +- Bugfix: Search field is not cleared after selection on + Watchers \[[#44469](https://community.openproject.org/wp/44469)\] +- Bugfix: Users who are not allowed to see hourly rates see planned and booked labor costs in + budgets \[[#45834](https://community.openproject.org/wp/45834)\] +- Bugfix: No space between avatar and username in the github tab of a work + package \[[#46215](https://community.openproject.org/wp/46215)\] +- Bugfix: Missing space on the left of the advanced filter \[[#46346](https://community.openproject.org/wp/46346)\] +- Bugfix: Meeting Minutes: Toggling preview mode causes losing + content \[[#48210](https://community.openproject.org/wp/48210)\] +- Bugfix: +Create button disabled after creating a child work package until reloading the + page \[[#49136](https://community.openproject.org/wp/49136)\] +- Bugfix: Missing space between avatars and usernames in Administration -> + Users \[[#50213](https://community.openproject.org/wp/50213)\] +- Bugfix: Taskboard column width stopped working \[[#51416](https://community.openproject.org/wp/51416)\] +- Bugfix: Double close button on Share modal for mobile \[[#51699](https://community.openproject.org/wp/51699)\] +- Bugfix: Odd spacing in Notification and Email Reminder personal setting + pages \[[#51772](https://community.openproject.org/wp/51772)\] +- Bugfix: Misleading error message: IFC upload (file size) \[[#52098](https://community.openproject.org/wp/52098)\] +- Bugfix: OpenProject behind prefix some assests still loaded from web + root \[[#52292](https://community.openproject.org/wp/52292)\] +- Bugfix: Position of status selector too high after opening the drop + down \[[#52669](https://community.openproject.org/wp/52669)\] +- Bugfix: Add meaningful flash error message when user cancels OAuth flow on + OneDrive/SharePoint \[[#52798](https://community.openproject.org/wp/52798)\] +- Bugfix: Waiting modal stuck on network error \[[#53005](https://community.openproject.org/wp/53005)\] +- Bugfix: Imprint Menu Label is not localized \[[#53062](https://community.openproject.org/wp/53062)\] +- Bugfix: Logo not reset when logo file is deleted \[[#53121](https://community.openproject.org/wp/53121)\] +- Bugfix: Health status is not showing for OneDrive storages \[[#53202](https://community.openproject.org/wp/53202)\] +- Bugfix: Error when sorting projects list by "latest activity + at" \[[#53315](https://community.openproject.org/wp/53315)\] +- Bugfix: Cannot modify a query that was created by a deleted + user \[[#53344](https://community.openproject.org/wp/53344)\] +- Bugfix: [AppSignal] Investigate absence of oauth_client for OneDrive + storage. \[[#53345](https://community.openproject.org/wp/53345)\] +- Bugfix: Autocompleters do not find users with accent when using simple + letter \[[#53371](https://community.openproject.org/wp/53371)\] +- Bugfix: Project custom fields and project description no longer allows + macros \[[#53391](https://community.openproject.org/wp/53391)\] +- Bugfix: OAuth flow causes loss of already selected option while adding a storage to a + project \[[#53394](https://community.openproject.org/wp/53394)\] +- Bugfix: Calendar buttons are not translated \[[#53422](https://community.openproject.org/wp/53422)\] +- Bugfix: Project storage main-menu links do not include prefix \[[#53429](https://community.openproject.org/wp/53429)\] +- Bugfix: Empty assignee board for user with reader role \[[#53436](https://community.openproject.org/wp/53436)\] +- Bugfix: Toolbar buttons too close on user page \[[#53477](https://community.openproject.org/wp/53477)\] +- Bugfix: Link on top of the storage should be removed if the read_files permission is missing when it is a + automatically managed project folder. \[[#53484](https://community.openproject.org/wp/53484)\] +- Bugfix: Buttons have the wrong colour in freshly seeded BIM + instance \[[#53504](https://community.openproject.org/wp/53504)\] +- Bugfix: Removing a project custom field stored as a filter in a project list leads to wrong counter + value \[[#53585](https://community.openproject.org/wp/53585)\] +- Bugfix: Meetings: Remove the "Add notes" item from the dropdown menu when notes already + exist \[[#53618](https://community.openproject.org/wp/53618)\] +- Bugfix: Macros text should wrap \[[#53644](https://community.openproject.org/wp/53644)\] +- Bugfix: Error in french translation \[[#53673](https://community.openproject.org/wp/53673)\] +- Bugfix: Visible=false project attribute values are deleted when a non-admin user edits the + attributes \[[#53704](https://community.openproject.org/wp/53704)\] +- Bugfix: Reordering project attributes is popping back on + render \[[#53706](https://community.openproject.org/wp/53706)\] +- Bugfix: ckEditor "..." more menu is overflowing the project custom field + dialog. \[[#53724](https://community.openproject.org/wp/53724)\] +- Bugfix: Fill custom_field_section_id when migrating CreateCustomFieldSections for the first + time \[[#53728](https://community.openproject.org/wp/53728)\] +- Bugfix: Insert code snippet or link modal opens behind the project attributes + modal \[[#53730](https://community.openproject.org/wp/53730)\] +- Bugfix: Action menu position on project attributes admin settings page + broken \[[#53735](https://community.openproject.org/wp/53735)\] +- Bugfix: Project attribute edit button doesn't work \[[#53739](https://community.openproject.org/wp/53739)\] +- Bugfix: Missing translation in help menu for Legal Notice menu + item \[[#53768](https://community.openproject.org/wp/53768)\] +- Bugfix: Project attribute edit menu jumps out of place \[[#53790](https://community.openproject.org/wp/53790)\] +- Bugfix: Deletion dialog does not provide enough context \[[#53802](https://community.openproject.org/wp/53802)\] +- Bugfix: Meeting agenda item overflow with long work package + subject \[[#53812](https://community.openproject.org/wp/53812)\] +- Bugfix: Blank page when clicking a link in meeting agenda item + notes \[[#53813](https://community.openproject.org/wp/53813)\] +- Bugfix: workPackageValue macro for milestone cannot use startDate and + dueDate \[[#53814](https://community.openproject.org/wp/53814)\] +- Bugfix: Dynamics meetings: Macro button for new work packages leads to a blank + page \[[#53935](https://community.openproject.org/wp/53935)\] +- Bugfix: New GitLab integration tab content is displayed in front of all + popups \[[#53948](https://community.openproject.org/wp/53948)\] +- Bugfix: Editing the work package to a different work package doesn't show clearly in the Meeting + history \[[#53976](https://community.openproject.org/wp/53976)\] +- Bugfix: Impossible to copy a project \[[#53990](https://community.openproject.org/wp/53990)\] +- Feature: Consistent calculation of progress (% Complete) in work package + hierarchies \[[#40749](https://community.openproject.org/wp/40749)\] +- Feature: Rename Delay to Lag \[[#44054](https://community.openproject.org/wp/44054)\] +- Feature: Save the "trashed" state of linked files in OpenProject's + cache \[[#45940](https://community.openproject.org/wp/45940)\] +- Feature: Group agenda items with sections \[[#49060](https://community.openproject.org/wp/49060)\] +- Feature: Exclude by status some work packages from the calculation of % Complete and work + estimates \[[#49409](https://community.openproject.org/wp/49409)\] +- Feature: Remove member and revoke shared work packages \[[#50266](https://community.openproject.org/wp/50266)\] +- Feature: Show meeting history / changes \[[#50820](https://community.openproject.org/wp/50820)\] +- Feature: Inform an admin via email about an unhealthy automatically managed file + storage \[[#50913](https://community.openproject.org/wp/50913)\] +- Feature: Fix seeding of status to include % Complete values \[[#50965](https://community.openproject.org/wp/50965)\] +- Feature: Persist the sort order of project lists \[[#51671](https://community.openproject.org/wp/51671)\] +- Feature: Allow renaming persisted project lists \[[#51673](https://community.openproject.org/wp/51673)\] +- Feature: "Save as" option in project list more menu \[[#51675](https://community.openproject.org/wp/51675)\] +- Feature: Global project attributes administration \[[#51789](https://community.openproject.org/wp/51789)\] +- Feature: Project-specific project attributes mapping \[[#51790](https://community.openproject.org/wp/51790)\] +- Feature: Display project attributes on project overview page \[[#51791](https://community.openproject.org/wp/51791)\] +- Feature: Remove project custom fields from global custom field settings + page \[[#51792](https://community.openproject.org/wp/51792)\] +- Feature: Split existing project administration settings into multiple + pages \[[#51793](https://community.openproject.org/wp/51793)\] +- Feature: Remove project custom fields widget \[[#51794](https://community.openproject.org/wp/51794)\] +- Feature: Adjust project API in order to respect project-specific custom + fields \[[#51796](https://community.openproject.org/wp/51796)\] +- Feature: Changing a persisted list (only own) \[[#52144](https://community.openproject.org/wp/52144)\] +- Feature: Copy automatically managed project folder on project copy for + OneDrive/SharePoint \[[#52175](https://community.openproject.org/wp/52175)\] +- Feature: Add toggle to deactivate/activate admin health notification for a + storage \[[#52449](https://community.openproject.org/wp/52449)\] +- Feature: File Storage Permissions explanation \[[#52571](https://community.openproject.org/wp/52571)\] +- Feature: Update the PageHeader component to do all required + actions \[[#52582](https://community.openproject.org/wp/52582)\] +- Feature: Changes in meeting automatically trigger email notification with updated ics + file \[[#52829](https://community.openproject.org/wp/52829)\] +- Feature: Show involved persons of agenda items \[[#52830](https://community.openproject.org/wp/52830)\] +- Feature: Improve UI for OneDrive/SharePoint file storage + settings \[[#52892](https://community.openproject.org/wp/52892)\] +- Feature: Restrict filtering on custom values that are not active + attributes \[[#53007](https://community.openproject.org/wp/53007)\] +- Feature: Sort work packages autocompletion by descending updated at time in meetings + module \[[#53033](https://community.openproject.org/wp/53033)\] +- Feature: Nudge user to login to storage upon project storage + edit \[[#53058](https://community.openproject.org/wp/53058)\] +- Feature: Reduce configurable design variables \[[#53309](https://community.openproject.org/wp/53309)\] +- Feature: Change row break in email notifications \[[#53316](https://community.openproject.org/wp/53316)\] +- Feature: Disable name and email fields in user profile for LDAP + user \[[#53330](https://community.openproject.org/wp/53330)\] +- Feature: Have only non bundled gems appear in the Plugin list \[[#53346](https://community.openproject.org/wp/53346)\] +- Feature: Fine-tuning of truncation feature in project list and project + overview \[[#53373](https://community.openproject.org/wp/53373)\] +- Feature: Before saving a OneDrive/SharePoint storage the storage settings should be validated against + OneDrive/SharePoint \[[#53386](https://community.openproject.org/wp/53386)\] +- Feature: Allow setting createdAt, author via API \[[#53423](https://community.openproject.org/wp/53423)\] +- Feature: Make the Author field editable or settable \[[#53444](https://community.openproject.org/wp/53444)\] +- Feature: Allow 4 and 8 week display modes in team planner \[[#53475](https://community.openproject.org/wp/53475)\] +- Feature: Allow umlauts for login name in OpenProject, LDAP + authentication \[[#53486](https://community.openproject.org/wp/53486)\] +- Feature: Meetings: Improve attachments \[[#53506](https://community.openproject.org/wp/53506)\] +- Feature: Support setting accountable to current user via custom + action \[[#53507](https://community.openproject.org/wp/53507)\] +- Feature: Add separate checkbox about attachments when user copies a + meeting \[[#53568](https://community.openproject.org/wp/53568)\] +- Feature: Handle no active project attributes in project overview + sidebar \[[#53577](https://community.openproject.org/wp/53577)\] +- Feature: Check if and how project activity logs should be + adapted \[[#53580](https://community.openproject.org/wp/53580)\] +- Feature: Disable the macros for the project custom fields. \[[#53701](https://community.openproject.org/wp/53701)\] +- Feature: Project creation with project attributes \[[#53703](https://community.openproject.org/wp/53703)\] +- Feature: Project copy with project attributes \[[#53705](https://community.openproject.org/wp/53705)\] +- Feature: Project export with disabled project attributes \[[#53733](https://community.openproject.org/wp/53733)\] +- Feature: Removing a work package from a agenda should be called "Remove" instead of " + Delete" \[[#53766](https://community.openproject.org/wp/53766)\] +- Feature: Add % Complete to section "Estimates and time" \[[#53771](https://community.openproject.org/wp/53771)\] +- Feature: Show diff for changes in meeting agenda items \[[#53975](https://community.openproject.org/wp/53975)\] +- Feature: Progress reporting for work package hierarchies \[[#40867](https://community.openproject.org/wp/40867)\] +- Feature: Custom set of project attributes grouped in sections \[[#49688](https://community.openproject.org/wp/49688)\] +- Feature: Copy of template projects including their project folders in + SharePoint \[[#51000](https://community.openproject.org/wp/51000)\] +- Feature: Email notifications for unhealthy file storages \[[#52840](https://community.openproject.org/wp/52840)\] + + + + +#### Contributions + +A big thanks to community members for reporting bugs and helping us identifying and providing fixes. + +Special thanks for reporting and finding bugs go to + +Silas Kropf, Philipp Schulz, Benjamin Rönnau, Mario Haustein, Matt User, Mario Zeppin, Romain Besson, Cécile Guiot, +Daniel Hilbrand, Christina Vechkanova, Sven Kunze, Richard Richter, Julian Wolff diff --git a/lib/api/v3/relations/relation_representer.rb b/lib/api/v3/relations/relation_representer.rb index 3c4556c1f151..e14d05561939 100644 --- a/lib/api/v3/relations/relation_representer.rb +++ b/lib/api/v3/relations/relation_representer.rb @@ -61,8 +61,8 @@ class RelationRepresenter < ::API::Decorators::Single property :reverse_type, as: :reverseType, exec_context: :decorator ## - # The `delay` property is only used for the relation type "precedes/follows". - property :delay, + # The `lag` property is only used for the relation type "precedes/follows". + property :lag, render_nil: true, if: ->(*) { # the relation type may be blank when parsing for an update diff --git a/lib/services/create_relation.rb b/lib/services/create_relation.rb index e9491493363a..351113d8c389 100644 --- a/lib/services/create_relation.rb +++ b/lib/services/create_relation.rb @@ -31,7 +31,7 @@ def initialize(from_work_package, to_work_package, attrs = {}) @relation = from_work_package.new_relation.tap do |r| r.to = to_work_package r.relation_type = attrs[:relation_type] - r.delay = attrs[:delay] + r.lag = attrs[:lag] end end diff --git a/modules/xls_export/app/models/xls_export/work_package/exporter/xls.rb b/modules/xls_export/app/models/xls_export/work_package/exporter/xls.rb index d9b4f9cf4463..255075b34f8b 100644 --- a/modules/xls_export/app/models/xls_export/work_package/exporter/xls.rb +++ b/modules/xls_export/app/models/xls_export/work_package/exporter/xls.rb @@ -128,9 +128,9 @@ def unrelated_row(wp_columns) def relation_row(work_package, wp_columns, other, relation) type = relation_type work_package, other, relation - delay = relation ? relation.delay : "" + lag = relation ? relation.lag : "" description = relation ? relation.description : "" - relation_columns = ["", type, delay, description] + column_values(other) + relation_columns = ["", type, lag, description] + column_values(other) [""] + wp_columns + relation_columns end @@ -149,7 +149,7 @@ def relation_type(work_package, other, relation) def with_relations_headers [ Relation.human_attribute_name(:relation_type), - Relation.human_attribute_name(:delay), + Relation.human_attribute_name(:lag), Relation.human_attribute_name(:description) ] end diff --git a/modules/xls_export/spec/models/xls_export/work_package/exporter/xls_integration_spec.rb b/modules/xls_export/spec/models/xls_export/work_package/exporter/xls_integration_spec.rb index 7112e3447bf5..7b35482de9a5 100644 --- a/modules/xls_export/spec/models/xls_export/work_package/exporter/xls_integration_spec.rb +++ b/modules/xls_export/spec/models/xls_export/work_package/exporter/xls_integration_spec.rb @@ -87,7 +87,7 @@ expect(sheet.rows[1]) .to eq [ nil, "Type", "ID", "Subject", "Status", "Assignee", "Priority", - nil, "Relation type", "Delay", "Description", + nil, "Relation type", "Lag", "Description", "Type", "ID", "Subject", "Status", "Assignee", "Priority", nil ] @@ -134,7 +134,7 @@ nil, parent.type.name, parent.id.to_s, parent.subject, parent.status.name, parent.assigned_to, parent.priority.name, nil, "parent of", nil, nil, child_1.type.name, child_1.id.to_s, child_1.subject, child_1.status.name, child_1.assigned_to, child_1.priority.name - ] # delay nil as this is a parent-child relation not represented by an actual Relation record + ] # lag nil as this is a parent-child relation not represented by an actual Relation record expect(sheet.row(SINGLE)) .to eq [ diff --git a/spec/contracts/relations/create_contract_spec.rb b/spec/contracts/relations/create_contract_spec.rb index 47cd3de84b0c..36fd49415085 100644 --- a/spec/contracts/relations/create_contract_spec.rb +++ b/spec/contracts/relations/create_contract_spec.rb @@ -35,7 +35,7 @@ Relation.new from: relation_from, to: relation_to, relation_type:, - delay: relation_delay + lag: relation_lag end end end diff --git a/spec/contracts/relations/shared_contract_examples.rb b/spec/contracts/relations/shared_contract_examples.rb index 175801fd373f..ab8153029c8f 100644 --- a/spec/contracts/relations/shared_contract_examples.rb +++ b/spec/contracts/relations/shared_contract_examples.rb @@ -51,7 +51,7 @@ let(:relation_type) do Relation::TYPE_RELATES end - let(:relation_delay) { 42 } + let(:relation_lag) { 42 } let!(:wp_visible_scope) do instance_double(ActiveRecord::Relation).tap do |relation| allow(WorkPackage) diff --git a/spec/contracts/relations/update_contract_spec.rb b/spec/contracts/relations/update_contract_spec.rb index d8c925dd0959..c18527dd625e 100644 --- a/spec/contracts/relations/update_contract_spec.rb +++ b/spec/contracts/relations/update_contract_spec.rb @@ -36,7 +36,7 @@ from: relation_from, to: relation_to, relation_type:, - delay: relation_delay) + lag: relation_lag) end end diff --git a/spec/factories/relation_factory.rb b/spec/factories/relation_factory.rb index dfb814b572e6..e3b96d33b85f 100644 --- a/spec/factories/relation_factory.rb +++ b/spec/factories/relation_factory.rb @@ -31,12 +31,12 @@ from factory: :work_package to { build(:work_package, project: from.project) } relation_type { "relates" } # "relates", "duplicates", "duplicated", "blocks", "blocked", "precedes", "follows" - delay { nil } + lag { nil } description { nil } end factory :follows_relation, parent: :relation do relation_type { "follows" } - delay { 0 } + lag { 0 } end end diff --git a/spec/lib/api/v3/relations/relation_representer_spec.rb b/spec/lib/api/v3/relations/relation_representer_spec.rb index 13f313fefb65..318ff6dd1f93 100644 --- a/spec/lib/api/v3/relations/relation_representer_spec.rb +++ b/spec/lib/api/v3/relations/relation_representer_spec.rb @@ -36,7 +36,7 @@ let(:type) { "follows" } let(:description) { "This first" } - let(:delay) { 3 } + let(:lag) { 3 } let(:relation) do build_stubbed(:relation, @@ -44,7 +44,7 @@ to:, relation_type: type, description:, - delay:) + lag:) end let(:representer) { described_class.new relation, current_user: user } @@ -79,7 +79,7 @@ "type" => "follows", "reverseType" => "precedes", "description" => description, - "delay" => delay + "lag" => lag } end @@ -95,9 +95,9 @@ expect(rel.from_id).to eq from.id.to_s expect(rel.to_id).to eq to.id.to_s - expect(rel.delay).to eq delay + expect(rel.lag).to eq lag expect(rel.relation_type).to eq type expect(rel.description).to eq description - expect(rel.delay).to eq delay + expect(rel.lag).to eq lag end end diff --git a/spec/models/relation_spec.rb b/spec/models/relation_spec.rb index 312e9a2ae05e..5926a5853e1e 100644 --- a/spec/models/relation_spec.rb +++ b/spec/models/relation_spec.rb @@ -77,7 +77,7 @@ end it "fails validation with invalid date and reverses" do - relation.delay = "xx" + relation.lag = "xx" expect(relation).not_to be_valid expect(relation.save).to be(false) @@ -170,16 +170,16 @@ end end - context "with a follows relation with a delay" do + context "with a follows relation with a lag" do let_schedule(<<~CHART) days | MTWTFSS | main | X | - follower_a | | follows main with delay 0 - follower_b | | follows main with delay 1 - follower_c | | follows main with delay 3 + follower_a | | follows main with lag 0 + follower_b | | follows main with lag 1 + follower_c | | follows main with lag 3 CHART - it "returns predecessor due_date + delay + 1" do + it "returns predecessor due_date + lag + 1" do relation_a = schedule.follows_relation(from: "follower_a", to: "main") expect(relation_a.successor_soonest_start).to eq(schedule.tuesday) @@ -191,57 +191,57 @@ end end - context "with a follows relation with a delay and with non-working days in the delay period" do + context "with a follows relation with a lag and with non-working days in the lag period" do let_schedule(<<~CHART) days | MTWTFSSmtw | main | X░ ░ ░░ ░ | - follower_delay0 | ░ ░ ░░ ░ | follows main with delay 0 - follower_delay1 | ░ ░ ░░ ░ | follows main with delay 1 - follower_delay2 | ░ ░ ░░ ░ | follows main with delay 2 - follower_delay3 | ░ ░ ░░ ░ | follows main with delay 3 + follower_lag0 | ░ ░ ░░ ░ | follows main with lag 0 + follower_lag1 | ░ ░ ░░ ░ | follows main with lag 1 + follower_lag2 | ░ ░ ░░ ░ | follows main with lag 2 + follower_lag3 | ░ ░ ░░ ░ | follows main with lag 3 CHART - it "returns a date such as the number of working days between both work package is equal to the delay" do + it "returns a date such as the number of working days between both work package is equal to the lag" do set_work_week("monday", "wednesday", "friday") - relation_delay0 = schedule.follows_relation(from: "follower_delay0", to: "main") - expect(relation_delay0.successor_soonest_start).to eq(schedule.wednesday) + relation_lag0 = schedule.follows_relation(from: "follower_lag0", to: "main") + expect(relation_lag0.successor_soonest_start).to eq(schedule.wednesday) - relation_delay1 = schedule.follows_relation(from: "follower_delay1", to: "main") - expect(relation_delay1.successor_soonest_start).to eq(schedule.friday) + relation_lag1 = schedule.follows_relation(from: "follower_lag1", to: "main") + expect(relation_lag1.successor_soonest_start).to eq(schedule.friday) - relation_delay2 = schedule.follows_relation(from: "follower_delay2", to: "main") - expect(relation_delay2.successor_soonest_start).to eq(schedule.monday + 7.days) + relation_lag2 = schedule.follows_relation(from: "follower_lag2", to: "main") + expect(relation_lag2.successor_soonest_start).to eq(schedule.monday + 7.days) - relation_delay3 = schedule.follows_relation(from: "follower_delay3", to: "main") - expect(relation_delay3.successor_soonest_start).to eq(schedule.wednesday + 7.days) + relation_lag3 = schedule.follows_relation(from: "follower_lag3", to: "main") + expect(relation_lag3.successor_soonest_start).to eq(schedule.wednesday + 7.days) end end - context "with a follows relation with a delay, non-working days, and follower ignoring non-working days" do + context "with a follows relation with a lag, non-working days, and follower ignoring non-working days" do let_schedule(<<~CHART) days | MTWTFSSmtw | main | X░ ░ ░░ ░ | - follower_delay0 | ░ ░ ░░ ░ | follows main with delay 0, working days include weekends - follower_delay1 | ░ ░ ░░ ░ | follows main with delay 1, working days include weekends - follower_delay2 | ░ ░ ░░ ░ | follows main with delay 2, working days include weekends - follower_delay3 | ░ ░ ░░ ░ | follows main with delay 3, working days include weekends + follower_lag0 | ░ ░ ░░ ░ | follows main with lag 0, working days include weekends + follower_lag1 | ░ ░ ░░ ░ | follows main with lag 1, working days include weekends + follower_lag2 | ░ ░ ░░ ░ | follows main with lag 2, working days include weekends + follower_lag3 | ░ ░ ░░ ░ | follows main with lag 3, working days include weekends CHART - it "returns predecessor due_date + delay + 1 (like without non-working days)" do + it "returns predecessor due_date + lag + 1 (like without non-working days)" do set_work_week("monday", "wednesday", "friday") - relation_delay0 = schedule.follows_relation(from: "follower_delay0", to: "main") - expect(relation_delay0.successor_soonest_start).to eq(schedule.tuesday) + relation_lag0 = schedule.follows_relation(from: "follower_lag0", to: "main") + expect(relation_lag0.successor_soonest_start).to eq(schedule.tuesday) - relation_delay1 = schedule.follows_relation(from: "follower_delay1", to: "main") - expect(relation_delay1.successor_soonest_start).to eq(schedule.wednesday) + relation_lag1 = schedule.follows_relation(from: "follower_lag1", to: "main") + expect(relation_lag1.successor_soonest_start).to eq(schedule.wednesday) - relation_delay2 = schedule.follows_relation(from: "follower_delay2", to: "main") - expect(relation_delay2.successor_soonest_start).to eq(schedule.thursday) + relation_lag2 = schedule.follows_relation(from: "follower_lag2", to: "main") + expect(relation_lag2.successor_soonest_start).to eq(schedule.thursday) - relation_delay3 = schedule.follows_relation(from: "follower_delay3", to: "main") - expect(relation_delay3.successor_soonest_start).to eq(schedule.friday) + relation_lag3 = schedule.follows_relation(from: "follower_lag3", to: "main") + expect(relation_lag3.successor_soonest_start).to eq(schedule.friday) end end end diff --git a/spec/models/work_packages/scopes/covering_dates_and_days_of_week_spec.rb b/spec/models/work_packages/scopes/covering_dates_and_days_of_week_spec.rb index d1aea82e5521..8c38183c4a0f 100644 --- a/spec/models/work_packages/scopes/covering_dates_and_days_of_week_spec.rb +++ b/spec/models/work_packages/scopes/covering_dates_and_days_of_week_spec.rb @@ -116,13 +116,13 @@ .to eq([]) end - it "does not return work packages having follows relation with delay covering the given days of week" do + it "does not return work packages having follows relation with lag covering the given days of week" do create_schedule(<<~CHART) days | MTWTFSS | not_covered1 | X | - follower1 | X | follows not_covered1 with delay 3 + follower1 | X | follows not_covered1 with lag 3 not_covered2 | X | - follower2 | X | follows not_covered2 with delay 1 + follower2 | X | follows not_covered2 with lag 1 CHART expect(WorkPackage.covering_dates_and_days_of_week(**day_args[:tuesday, :thursday])) diff --git a/spec/requests/api/v3/relations/relations_api_spec.rb b/spec/requests/api/v3/relations/relations_api_spec.rb index fbb1d59d3801..a64fbbb3a4db 100644 --- a/spec/requests/api/v3/relations/relations_api_spec.rb +++ b/spec/requests/api/v3/relations/relations_api_spec.rb @@ -39,7 +39,7 @@ let(:type) { "follows" } let(:description) { "This first" } - let(:delay) { 3 } + let(:lag) { 3 } let(:params) do { @@ -53,7 +53,7 @@ }, type:, description:, - delay: + lag: } end let(:relation) do @@ -62,7 +62,7 @@ to:, relation_type: type, description:, - delay:) + lag:) end before do @@ -78,7 +78,7 @@ expect(rel.to).to eq to expect(rel.relation_type).to eq type expect(rel.description).to eq description - expect(rel.delay).to eq delay + expect(rel.lag).to eq lag end end @@ -226,12 +226,12 @@ describe "updating a relation" do let(:new_description) { "This is another description" } - let(:new_delay) { 42 } + let(:new_lag) { 42 } let(:update) do { description: new_description, - delay: new_delay + lag: new_lag } end @@ -249,8 +249,8 @@ expect(relation.reload.description).to eq new_description end - it "updates the relation's delay" do - expect(relation.reload.delay).to eq new_delay + it "updates the relation's lag" do + expect(relation.reload.lag).to eq new_lag end it "returns the updated relation" do diff --git a/spec/services/relations/create_service_spec.rb b/spec/services/relations/create_service_spec.rb index 6d2371a621bc..fdf39d5051ae 100644 --- a/spec/services/relations/create_service_spec.rb +++ b/spec/services/relations/create_service_spec.rb @@ -35,7 +35,7 @@ let(:work_package2_due_date) { nil } let(:follows_relation) { false } - let(:delay) { 3 } + let(:lag) { 3 } let(:work_package1) do build_stubbed(:work_package, @@ -63,7 +63,7 @@ { to: work_package1, from: work_package2, - delay: + lag: } end diff --git a/spec/services/relations/update_service_spec.rb b/spec/services/relations/update_service_spec.rb index e008a6ef57fc..7868ae19d1b6 100644 --- a/spec/services/relations/update_service_spec.rb +++ b/spec/services/relations/update_service_spec.rb @@ -35,7 +35,7 @@ let(:work_package2_due_date) { nil } let(:follows_relation) { false } - let(:delay) { 3 } + let(:lag) { 3 } let(:work_package1) do build_stubbed(:work_package, @@ -63,7 +63,7 @@ { to: work_package1, from: work_package2, - delay: + lag: } end diff --git a/spec/services/work_packages/set_schedule_service_spec.rb b/spec/services/work_packages/set_schedule_service_spec.rb index 1ddef14287c6..8062b24e560f 100644 --- a/spec/services/work_packages/set_schedule_service_spec.rb +++ b/spec/services/work_packages/set_schedule_service_spec.rb @@ -47,27 +47,27 @@ let(:follower1_start_date) { Time.zone.today + 1.day } let(:follower1_due_date) { Time.zone.today + 3.days } - let(:follower1_delay) { 0 } + let(:follower1_lag) { 0 } let(:following_work_package1) do create_follower(follower1_start_date, follower1_due_date, - { work_package => follower1_delay }) + { work_package => follower1_lag }) end let(:follower2_start_date) { Time.zone.today + 4.days } let(:follower2_due_date) { Time.zone.today + 8.days } - let(:follower2_delay) { 0 } + let(:follower2_lag) { 0 } let(:following_work_package2) do create_follower(follower2_start_date, follower2_due_date, - { following_work_package1 => follower2_delay }) + { following_work_package1 => follower2_lag }) end let(:follower3_start_date) { Time.zone.today + 9.days } let(:follower3_due_date) { Time.zone.today + 10.days } - let(:follower3_delay) { 0 } + let(:follower3_lag) { 0 } let(:following_work_package3) do create_follower(follower3_start_date, follower3_due_date, - { following_work_package2 => follower3_delay }) + { following_work_package2 => follower3_lag }) end let(:parent_follower1_start_date) { follower1_start_date } @@ -93,9 +93,9 @@ def create_follower(start_date, due_date, predecessors, parent: nil) due_date:, parent:) - predecessors.map do |predecessor, delay| + predecessors.map do |predecessor, lag| create(:follows_relation, - delay:, + lag:, from: work_package, to: predecessor) end @@ -273,10 +273,10 @@ def create_child(parent, start_date, due_date) it_behaves_like 'does not reschedule' end - context 'when moving forward with the follower having some space left and a delay' do + context 'when moving forward with the follower having some space left and a lag' do let(:follower1_start_date) { Time.zone.today + 5.days } let(:follower1_due_date) { Time.zone.today + 7.days } - let(:follower1_delay) { 3 } + let(:follower1_lag) { 3 } before do work_package.due_date = Time.zone.today + 5.days @@ -421,7 +421,7 @@ def create_child(parent, start_date, due_date) let(:following_work_package1) do create_follower(follower1_start_date, follower1_due_date, - { work_package => follower1_delay, + { work_package => follower1_lag, another_successor => 0 }) end let(:another_successor) do @@ -743,20 +743,20 @@ def create_child(parent, start_date, due_date) context 'with a chain of successors with two paths leading to the same work package in the end' do let(:follower3_start_date) { Time.zone.today + 4.days } let(:follower3_due_date) { Time.zone.today + 7.days } - let(:follower3_delay) { 0 } + let(:follower3_lag) { 0 } let(:following_work_package3) do create_follower(follower3_start_date, follower3_due_date, - { work_package => follower3_delay }) + { work_package => follower3_lag }) end let(:follower4_start_date) { Time.zone.today + 9.days } let(:follower4_due_date) { Time.zone.today + 10.days } - let(:follower4_delay2) { 0 } - let(:follower4_delay3) { 0 } + let(:follower4_lag2) { 0 } + let(:follower4_lag3) { 0 } let(:following_work_package4) do create_follower(follower4_start_date, follower4_due_date, - { following_work_package2 => follower4_delay2, following_work_package3 => follower4_delay3 }) + { following_work_package2 => follower4_lag2, following_work_package3 => follower4_lag3 }) end let!(:following) do [following_work_package1, diff --git a/spec/services/work_packages/set_schedule_service_working_days_spec.rb b/spec/services/work_packages/set_schedule_service_working_days_spec.rb index 2d7f1a9f1b9c..ae53f37c86a0 100644 --- a/spec/services/work_packages/set_schedule_service_working_days_spec.rb +++ b/spec/services/work_packages/set_schedule_service_working_days_spec.rb @@ -254,11 +254,11 @@ end end - context "with the follower having some space left and a delay" do + context "with the follower having some space left and a lag" do let_schedule(<<~CHART) days | MTWTFSSmtwtfss | work_package | X | - follower | XXX | follows work_package with delay 3 + follower | XXX | follows work_package with lag 3 CHART before do @@ -268,7 +268,7 @@ CHART end - it "reschedules the follower to start after the delay" do + it "reschedules the follower to start after the lag" do expect_schedule(subject.all_results, <<~CHART) | MTWTFSSmtwtfss | work_package | XXXXX..X | @@ -277,11 +277,11 @@ end end - context "with the follower having a delay overlapping non-working days" do + context "with the follower having a lag overlapping non-working days" do let_schedule(<<~CHART) days | MTWTFSS | work_package | X | - follower | XX | follows work_package with delay 2 + follower | XX | follows work_package with lag 2 CHART before do @@ -291,7 +291,7 @@ CHART end - it "reschedules the follower to start after the non-working days and the delay" do + it "reschedules the follower to start after the non-working days and the lag" do expect(subject.all_results).to match_schedule(<<~CHART) | MTWTFSSmtwt | work_package | X | @@ -350,7 +350,7 @@ let_schedule(<<~CHART) days | mtwtfssmtwtfssMTWTFSS | work_package | X | - follower | XX | follows work_package, follows annoyer with delay 2 + follower | XX | follows work_package, follows annoyer with lag 2 annoyer | XX..XX | CHART @@ -943,12 +943,12 @@ end end - context "when moving forward with some delay and spaces between the followers" do + context "when moving forward with some lag and spaces between the followers" do let_schedule(<<~CHART) days | MTWTFSSm sm sm | work_package | ] | follower1 | XXX | follows work_package - follower2 | XXXX | follows follower1 with delay 3 + follower2 | XXXX | follows follower1 with lag 3 follower3 | XXX..XX | follows follower2 follower4 | XX | follows follower3 CHART @@ -960,7 +960,7 @@ CHART end - it "reschedules all the followers keeping the delay and compacting the extra spaces" do + it "reschedules all the followers keeping the lag and compacting the extra spaces" do expect(subject.all_results).to match_schedule(<<~CHART) days | MTWTFSSm sm sm sm | work_package | ] | @@ -994,7 +994,7 @@ CHART end - it "reschedules all the followers keeping the delay and compacting the extra spaces" do + it "reschedules all the followers keeping the lag and compacting the extra spaces" do expect(subject.all_results).to match_schedule(<<~CHART) days | MTWTFSSm w m | work_package | X.X | @@ -1125,7 +1125,7 @@ let_schedule(<<~CHART) days | MTWTFSS | work_package | | - new_parent | | follows new_parent_predecessor with delay 3 + new_parent | | follows new_parent_predecessor with lag 3 new_parent_predecessor | X | CHART @@ -1147,7 +1147,7 @@ let_schedule(<<~CHART) days | MTWTFSS | work_package | | duration 4 - new_parent | | follows new_parent_predecessor with delay 3 + new_parent | | follows new_parent_predecessor with lag 3 new_parent_predecessor | X | CHART @@ -1170,7 +1170,7 @@ let_schedule(<<~CHART) days | MTWTFSS | work_package | ] | - new_parent | | follows new_parent_predecessor with delay 3 + new_parent | | follows new_parent_predecessor with lag 3 new_parent_predecessor | X | CHART @@ -1192,7 +1192,7 @@ let_schedule(<<~CHART) days | MTWTFSS | work_package | ] | - new_parent | | follows new_parent_predecessor with delay 3 + new_parent | | follows new_parent_predecessor with lag 3 new_parent_predecessor | X | CHART @@ -1214,7 +1214,7 @@ let_schedule(<<~CHART) days | MTWTFSS | work_package | XX | - new_parent | | follows new_parent_predecessor with delay 3 + new_parent | | follows new_parent_predecessor with lag 3 new_parent_predecessor | X | CHART diff --git a/spec/services/work_packages/shared/all_days_spec.rb b/spec/services/work_packages/shared/all_days_spec.rb index b131e1214821..b74103033b17 100644 --- a/spec/services/work_packages/shared/all_days_spec.rb +++ b/spec/services/work_packages/shared/all_days_spec.rb @@ -142,11 +142,11 @@ expect(subject.soonest_working_day(nil)).to be_nil end - context "with delay" do - it "returns the soonest working day from the given day, after a configurable delay of working days" do - expect(subject.soonest_working_day(sunday_2022_07_31, delay: nil)).to eq(sunday_2022_07_31) - expect(subject.soonest_working_day(sunday_2022_07_31, delay: 0)).to eq(sunday_2022_07_31) - expect(subject.soonest_working_day(sunday_2022_07_31, delay: 1)).to eq(Date.new(2022, 8, 1)) + context "with lag" do + it "returns the soonest working day from the given day, after a configurable lag of working days" do + expect(subject.soonest_working_day(sunday_2022_07_31, lag: nil)).to eq(sunday_2022_07_31) + expect(subject.soonest_working_day(sunday_2022_07_31, lag: 0)).to eq(sunday_2022_07_31) + expect(subject.soonest_working_day(sunday_2022_07_31, lag: 1)).to eq(Date.new(2022, 8, 1)) end end @@ -155,8 +155,8 @@ expect(subject.soonest_working_day(sunday_2022_07_31)).to eq(sunday_2022_07_31) end - context "with delay" do - include_examples "soonest working day with delay", date: Date.new(2022, 1, 1), delay: 30, expected: Date.new(2022, 1, 31) + context "with lag" do + include_examples "soonest working day with lag", date: Date.new(2022, 1, 1), lag: 30, expected: Date.new(2022, 1, 31) end end @@ -165,8 +165,8 @@ expect(subject.soonest_working_day(Date.new(2022, 12, 25))).to eq(Date.new(2022, 12, 25)) end - context "with delay" do - include_examples "soonest working day with delay", date: Date.new(2022, 12, 24), delay: 7, + context "with lag" do + include_examples "soonest working day with lag", date: Date.new(2022, 12, 24), lag: 7, expected: Date.new(2022, 12, 31) end end diff --git a/spec/services/work_packages/shared/shared_examples_days.rb b/spec/services/work_packages/shared/shared_examples_days.rb index 0f652d74615d..29033a2ee643 100644 --- a/spec/services/work_packages/shared/shared_examples_days.rb +++ b/spec/services/work_packages/shared/shared_examples_days.rb @@ -89,8 +89,8 @@ end end -RSpec.shared_examples "soonest working day with delay" do |date:, delay:, expected:| - it "soonest_working_day(#{date.to_fs(:wday_date)}, delay: #{delay.inspect}) => #{expected.to_fs(:wday_date)}" do - expect(subject.soonest_working_day(date, delay:)).to eq(expected) +RSpec.shared_examples "soonest working day with lag" do |date:, lag:, expected:| + it "soonest_working_day(#{date.to_fs(:wday_date)}, lag: #{lag.inspect}) => #{expected.to_fs(:wday_date)}" do + expect(subject.soonest_working_day(date, lag:)).to eq(expected) end end diff --git a/spec/services/work_packages/shared/working_days_spec.rb b/spec/services/work_packages/shared/working_days_spec.rb index 3835cd505291..a2be2810338f 100644 --- a/spec/services/work_packages/shared/working_days_spec.rb +++ b/spec/services/work_packages/shared/working_days_spec.rb @@ -188,16 +188,16 @@ expect(subject.soonest_working_day(nil)).to be_nil end - context "with delay" do - it "returns the soonest working day from the given day, after a configurable delay of working days" do - expect(subject.soonest_working_day(sunday_2022_07_31, delay: nil)).to eq(sunday_2022_07_31) - expect(subject.soonest_working_day(sunday_2022_07_31, delay: 0)).to eq(sunday_2022_07_31) - expect(subject.soonest_working_day(sunday_2022_07_31, delay: 1)).to eq(monday_2022_08_01) + context "with lag" do + it "returns the soonest working day from the given day, after a configurable lag of working days" do + expect(subject.soonest_working_day(sunday_2022_07_31, lag: nil)).to eq(sunday_2022_07_31) + expect(subject.soonest_working_day(sunday_2022_07_31, lag: 0)).to eq(sunday_2022_07_31) + expect(subject.soonest_working_day(sunday_2022_07_31, lag: 1)).to eq(monday_2022_08_01) end - it "works with big delay value like 100_000" do + it "works with big lag value like 100_000" do # First implementation was recursive and failed with SystemStackError: stack level too deep - expect { subject.soonest_working_day(sunday_2022_07_31, delay: 100_000) } + expect { subject.soonest_working_day(sunday_2022_07_31, lag: 100_000) } .not_to raise_error end end @@ -208,18 +208,18 @@ include_examples "soonest working day", date: sunday_2022_07_31, expected: monday_2022_08_01 include_examples "soonest working day", date: monday_2022_08_01, expected: monday_2022_08_01 - context "with delay" do - include_examples "soonest working day with delay", date: friday_2022_07_29, delay: 0, expected: friday_2022_07_29 - include_examples "soonest working day with delay", date: saturday_2022_07_30, delay: 0, expected: monday_2022_08_01 - include_examples "soonest working day with delay", date: sunday_2022_07_31, delay: 0, expected: monday_2022_08_01 - include_examples "soonest working day with delay", date: monday_2022_08_01, delay: 0, expected: monday_2022_08_01 + context "with lag" do + include_examples "soonest working day with lag", date: friday_2022_07_29, lag: 0, expected: friday_2022_07_29 + include_examples "soonest working day with lag", date: saturday_2022_07_30, lag: 0, expected: monday_2022_08_01 + include_examples "soonest working day with lag", date: sunday_2022_07_31, lag: 0, expected: monday_2022_08_01 + include_examples "soonest working day with lag", date: monday_2022_08_01, lag: 0, expected: monday_2022_08_01 - include_examples "soonest working day with delay", date: friday_2022_07_29, delay: 1, expected: monday_2022_08_01 - include_examples "soonest working day with delay", date: saturday_2022_07_30, delay: 1, expected: Date.new(2022, 8, 2) - include_examples "soonest working day with delay", date: sunday_2022_07_31, delay: 1, expected: Date.new(2022, 8, 2) - include_examples "soonest working day with delay", date: monday_2022_08_01, delay: 1, expected: Date.new(2022, 8, 2) + include_examples "soonest working day with lag", date: friday_2022_07_29, lag: 1, expected: monday_2022_08_01 + include_examples "soonest working day with lag", date: saturday_2022_07_30, lag: 1, expected: Date.new(2022, 8, 2) + include_examples "soonest working day with lag", date: sunday_2022_07_31, lag: 1, expected: Date.new(2022, 8, 2) + include_examples "soonest working day with lag", date: monday_2022_08_01, lag: 1, expected: Date.new(2022, 8, 2) - include_examples "soonest working day with delay", date: friday_2022_07_29, delay: 8, expected: Date.new(2022, 8, 10) + include_examples "soonest working day with lag", date: friday_2022_07_29, lag: 8, expected: Date.new(2022, 8, 10) end end @@ -228,8 +228,8 @@ include_examples "soonest working day", date: Date.new(2022, 12, 31), expected: Date.new(2022, 12, 31) include_examples "soonest working day", date: Date.new(2023, 1, 1), expected: Date.new(2023, 1, 2) - context "with delay" do - include_examples "soonest working day with delay", date: Date.new(2022, 12, 24), delay: 7, expected: Date.new(2023, 1, 2) + context "with lag" do + include_examples "soonest working day with lag", date: Date.new(2022, 12, 24), lag: 7, expected: Date.new(2023, 1, 2) end end diff --git a/spec/support/schedule_helpers/chart.rb b/spec/support/schedule_helpers/chart.rb index 42124c5ce4cf..503603511c03 100644 --- a/spec/support/schedule_helpers/chart.rb +++ b/spec/support/schedule_helpers/chart.rb @@ -87,7 +87,7 @@ def with(order: work_package_names, id_column_size: self.id_column_size, first_d chart.first_day = first_day chart.last_day = last_day chart.predecessors_by_followers = predecessors_by_followers - chart.delays_between = delays_between + chart.lags_between = lags_between chart.parent_by_child = parent_by_child chart end @@ -129,8 +129,8 @@ def predecessors_by_follower(follower) predecessors_by_followers[follower] end - def delay_between(predecessor:, follower:) - delays_between.fetch([predecessor, follower]) + def lag_between(predecessor:, follower:) + lags_between.fetch([predecessor, follower]) end def add_work_package(attributes) @@ -160,9 +160,9 @@ def set_ignore_non_working_days(name, ignore_non_working_days) attributes[:ignore_non_working_days] = ignore_non_working_days end - def add_follows_relation(predecessor:, follower:, delay:) + def add_follows_relation(predecessor:, follower:, lag:) predecessors_by_follower(follower) << predecessor - delays_between[[predecessor, follower]] = delay + lags_between[[predecessor, follower]] = lag end def add_parent_relation(parent:, child:) @@ -200,7 +200,7 @@ def compact_dates :first_day, :last_day, :predecessors_by_followers, - :delays_between, + :lags_between, :parent_by_child private @@ -252,8 +252,8 @@ def predecessors_by_followers @predecessors_by_followers ||= Hash.new { |h, k| h[k] = [] } end - def delays_between - @delays_between ||= Hash.new(0) + def lags_between + @lags_between ||= Hash.new(0) end def parent_by_child diff --git a/spec/support/schedule_helpers/chart_builder.rb b/spec/support/schedule_helpers/chart_builder.rb index 3d71625d9391..e7fcafe3ab6b 100644 --- a/spec/support/schedule_helpers/chart_builder.rb +++ b/spec/support/schedule_helpers/chart_builder.rb @@ -101,11 +101,11 @@ def parse_work_package_line(line) def parse_properties(name, property) case property - when /^follows (\w+)(?: with delay (\d+))?/ + when /^follows (\w+)(?: with lag (\d+))?/ chart.add_follows_relation( predecessor: $1.to_sym, follower: name.to_sym, - delay: $2.to_i + lag: $2.to_i ) when /^child of (\w+)/ chart.add_parent_relation( @@ -122,7 +122,7 @@ def parse_properties(name, property) spell_checker = DidYouMean::SpellChecker.new( dictionary: [ "follows :wp", - "follows :wp with delay :int", + "follows :wp with lag :int", "child of :wp", "duration :int", "working days work week", diff --git a/spec/support/schedule_helpers/example_methods.rb b/spec/support/schedule_helpers/example_methods.rb index 739ca4d79e23..bc0f88e71cf8 100644 --- a/spec/support/schedule_helpers/example_methods.rb +++ b/spec/support/schedule_helpers/example_methods.rb @@ -46,7 +46,7 @@ module ExampleMethods # create(:work_package, subject: 'follower', start_date: next_monday + 2.days, due_date: next_monday + 4.days) } # create(:work_package, subject: 'start_only', start_date: next_monday + 1.day) } # create(:work_package, subject: 'due_only', due_date: next_monday + 3.days) } - # create(:follows_relation, from: follower, to: main, delay: 0) } + # create(:follows_relation, from: follower, to: main, lag: 0) } # def create_schedule(chart_representation) chart = Chart.for(chart_representation) diff --git a/spec/support/schedule_helpers/schedule_builder.rb b/spec/support/schedule_helpers/schedule_builder.rb index 3d4ad1b747a9..f85ea86fca43 100644 --- a/spec/support/schedule_helpers/schedule_builder.rb +++ b/spec/support/schedule_helpers/schedule_builder.rb @@ -61,7 +61,7 @@ def create_follows_relations(follower) FactoryBot.create(:follows_relation, from: create_work_package(follower), to: create_work_package(predecessor), - delay: chart.delay_between(predecessor:, follower:)) + lag: chart.lag_between(predecessor:, follower:)) end end diff --git a/spec/support_spec/schedule_helpers/chart_builder_spec.rb b/spec/support_spec/schedule_helpers/chart_builder_spec.rb index 096dd94a5d2d..b73a33dbb0ec 100644 --- a/spec/support_spec/schedule_helpers/chart_builder_spec.rb +++ b/spec/support_spec/schedule_helpers/chart_builder_spec.rb @@ -107,7 +107,7 @@ follower | | follows main CHART expect(chart.predecessors_by_follower(:follower)).to eq([:main]) - expect(chart.delay_between(predecessor: :main, follower: :follower)).to eq(0) + expect(chart.lag_between(predecessor: :main, follower: :follower)).to eq(0) end it "can be declared in any order" do @@ -117,19 +117,19 @@ main | | CHART expect(chart.predecessors_by_follower(:follower)).to eq([:main]) - expect(chart.delay_between(predecessor: :main, follower: :follower)).to eq(0) + expect(chart.lag_between(predecessor: :main, follower: :follower)).to eq(0) end end - describe "follows with delay " do - it "adds a follows relation to the named with a delay" do + describe "follows with lag " do + it "adds a follows relation to the named with a lag" do chart = builder.parse(<<~CHART) days | MTWTFSS | main | | - follower | | follows main with delay 3 + follower | | follows main with lag 3 CHART expect(chart.predecessors_by_follower(:follower)).to eq([:main]) - expect(chart.delay_between(predecessor: :main, follower: :follower)).to eq(3) + expect(chart.lag_between(predecessor: :main, follower: :follower)).to eq(3) end end diff --git a/spec/support_spec/schedule_helpers/example_methods_spec.rb b/spec/support_spec/schedule_helpers/example_methods_spec.rb index 2f29d72f65a0..cb01a9bcb098 100644 --- a/spec/support_spec/schedule_helpers/example_methods_spec.rb +++ b/spec/support_spec/schedule_helpers/example_methods_spec.rb @@ -91,13 +91,13 @@ schedule = create_schedule(<<~CHART) days | MTWTFSS | predecessor | XX | - follower | X | follows predecessor with delay 2 + follower | X | follows predecessor with lag 2 CHART expect(Relation.count).to eq(1) expect(schedule.follows_relation(from: "follower", to: "predecessor")).to be_an_instance_of(Relation) expect(schedule.follows_relation(from: "follower", to: "predecessor")).to have_attributes( relation_type: "follows", - delay: 2, + lag: 2, from: schedule.work_package("follower"), to: schedule.work_package("predecessor") ) diff --git a/spec/support_spec/schedule_helpers/let_schedule_spec.rb b/spec/support_spec/schedule_helpers/let_schedule_spec.rb index 030b18d6d80f..a6e9f8b4d18b 100644 --- a/spec/support_spec/schedule_helpers/let_schedule_spec.rb +++ b/spec/support_spec/schedule_helpers/let_schedule_spec.rb @@ -35,7 +35,7 @@ let_schedule(<<~CHART) days | MTWTFSS | main | XX | - follower | XXX | follows main with delay 2 + follower | XXX | follows main with lag 2 child | | child of main CHART 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 e296de7ca974..5588405c4f62 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 @@ -207,18 +207,18 @@ end end - context "when a follower has a predecessor with delay covering a day that is now a non-working day" do + context "when a follower has a predecessor with lag covering a day that is now a non-working day" do let_schedule(<<~CHART) days | MTWTFSS | predecessor | XX ░░ | - follower | X ░░ | follows predecessor with delay 1 + follower | X ░░ | follows predecessor with lag 1 CHART before do set_non_working_week_days("wednesday") end - it "moves the follower start date forward to keep the delay to 1 day" do + it "moves the follower start date forward to keep the lag to 1 day" do subject expect(WorkPackage.all).to match_schedule(<<~CHART) days | MTWTFSS | @@ -243,11 +243,11 @@ end end - context "with work packages without dates following each other with delay" do + context "with work packages without dates following each other with lag" do let_schedule(<<~CHART) days | MTWTFSS | predecessor | ░░ | - follower | ░░ | follows predecessor with delay 5 + follower | ░░ | follows predecessor with lag 5 CHART before do @@ -270,11 +270,11 @@ end end - context "when a follower has a predecessor with delay covering multiple days with different working changes" do + context "when a follower has a predecessor with lag covering multiple days with different working changes" do let_schedule(<<~CHART) days | MTWTFSS | predecessor | X ░ ░░ | - follower | ░ X░░ | follows predecessor with delay 2 + follower | ░ X░░ | follows predecessor with lag 2 CHART let(:work_week) { set_work_week("monday", "tuesday", "thursday", "friday") } @@ -753,18 +753,18 @@ end end - context "when a follower has a predecessor with delay covering a day that is now a non-working day" do + context "when a follower has a predecessor with lag covering a day that is now a non-working day" do let_schedule(<<~CHART) days | MTWTFSS | predecessor | XX ░░ | - follower | X ░░ | follows predecessor with delay 1 + follower | X ░░ | follows predecessor with lag 1 CHART before do set_non_working_days(next_monday.next_occurring(:wednesday)) end - it "moves the follower start date forward to keep the delay to 1 day" do + it "moves the follower start date forward to keep the lag to 1 day" do subject expect(WorkPackage.all).to match_schedule(<<~CHART) days | MTWTFSS | @@ -789,11 +789,11 @@ end end - context "with work packages without dates following each other with delay" do + context "with work packages without dates following each other with lag" do let_schedule(<<~CHART) days | MTWTFSS | predecessor | ░░ | - follower | ░░ | follows predecessor with delay 5 + follower | ░░ | follows predecessor with lag 5 CHART before do @@ -816,11 +816,11 @@ end end - context "when a follower has a predecessor with delay covering multiple days with different working changes" do + context "when a follower has a predecessor with lag covering multiple days with different working changes" do let_schedule(<<~CHART) days | MTWTFSS | predecessor | X ░ ░░ | - follower | ░ X░░ | follows predecessor with delay 2 + follower | ░ X░░ | follows predecessor with lag 2 CHART let(:non_working_day) { create(:non_working_day, date: next_monday.next_occurring(:wednesday)) } @@ -1355,18 +1355,18 @@ end end - context "when a follower has a predecessor with delay covering a day that is now a non-working day" do + context "when a follower has a predecessor with lag covering a day that is now a non-working day" do let_schedule(<<~CHART) days | MTWTFSS | predecessor | XX ░░ | - follower | X ░░ | follows predecessor with delay 1 + follower | X ░░ | follows predecessor with lag 1 CHART before do set_non_working_days(next_monday.next_occurring(:wednesday)) end - it "moves the follower start date forward to keep the delay to 1 day" do + it "moves the follower start date forward to keep the lag to 1 day" do subject expect(WorkPackage.all).to match_schedule(<<~CHART) days | MTWTFSS | @@ -1391,11 +1391,11 @@ end end - context "with work packages without dates following each other with delay" do + context "with work packages without dates following each other with lag" do let_schedule(<<~CHART) days | MTWTFSS | predecessor | ░░ | - follower | ░░ | follows predecessor with delay 5 + follower | ░░ | follows predecessor with lag 5 CHART before do