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
Rename delay to lag
Oliver Günthere3e8d7897216
diff --git a/app/contracts/relations/base_contract.rb b/app/contracts/relations/base_contract.rbindex 2a1ddc9d705..24b9b23e0ce 100644--- a/app/contracts/relations/base_contract.rb+++ b/app/contracts/relations/base_contract.rb@@ -29,7 +29,7 @@module Relationsclass BaseContract < ::ModelContractattribute :relation_type- attribute :delay+ attribute :lagattribute :descriptionattribute :fromattribute :todiff --git a/app/models/relation.rb b/app/models/relation.rbindex 377fae809f4..a39f733dad7 100644--- a/app/models/relation.rb+++ b/app/models/relation.rb@@ -100,10 +100,10 @@ class Relation < ApplicationRecordscope :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 @@ class Relation < ApplicationRecordif 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:)endend@@ -146,13 +146,6 @@ class Relation < ApplicationRecordTYPES[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}?" docanonical_type == self.class.canonical_type(type)diff --git a/app/models/work_package/scheduling_rules.rb b/app/models/work_package/scheduling_rules.rbindex f236c9008da..8011943974b 100644--- a/app/models/work_package/scheduling_rules.rb+++ b/app/models/work_package/scheduling_rules.rb@@ -35,18 +35,18 @@ module WorkPackage::SchedulingRules# 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+ # AP(due_date: 2017/07/25)-precedes(lag: 0)-A# |# parent# |- # BP(due_date: 2017/07/22)-precedes(delay: 2)-B+ # BP(due_date: 2017/07/22)-precedes(lag: 2)-B# |# parent# |- # CP(due_date: 2017/07/25)-precedes(delay: 2)-C+ # CP(due_date: 2017/07/25)-precedes(lag: 2)-C## Then soonest_start for:# C is 2017/07/28diff --git a/app/services/relations/base_service.rb b/app/services/relations/base_service.rbindex bffa3e24c8b..a2da7f73b89 100644--- a/app/services/relations/base_service.rb+++ b/app/services/relations/base_service.rb@@ -55,9 +55,9 @@ class Relations::BaseService < BaseServices::BaseCallabledef set_defaults(model)if Relation::TYPE_FOLLOWS == model.relation_type- model.delay ||= 0+ model.lag ||= 0else- model.delay = nil+ model.lag = nilendenddiff --git a/app/services/work_packages/shared/all_days.rb b/app/services/work_packages/shared/all_days.rbindex 1f3a6d9e5cc..3efe16d213b 100644--- a/app/services/work_packages/shared/all_days.rb+++ b/app/services/work_packages/shared/all_days.rb@@ -50,9 +50,9 @@ module WorkPackagesstart_date + duration - 1end- 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 dateenddef working?(_date)diff --git a/app/services/work_packages/shared/working_days.rb b/app/services/work_packages/shared/working_days.rbindex e11907157c9..b7c87f2a5d0 100644--- a/app/services/work_packages/shared/working_days.rb+++ b/app/services/work_packages/shared/working_days.rb@@ -61,13 +61,13 @@ module WorkPackagesdue_dateend- 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 += 1enddiff --git a/app/workers/work_packages/apply_working_days_change_job.rb b/app/workers/work_packages/apply_working_days_change_job.rbindex feff945dc08..bc362b92e69 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 @@ class WorkPackages::ApplyWorkingDaysChangeJob < ApplicationJobdef 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)enddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 06a22a130d1..5517c501c6d 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -669,7 +669,7 @@ Project attributes and sections are defined in the <a href=%{admin_settings_url}oauth_client:client: "Client ID"relation:- delay: "Delay"+ lag: "Lag"from: "Work package"to: "Related work package"status:diff --git a/db/migrate/20240408132459_rename_delay_to_lag.rb b/db/migrate/20240408132459_rename_delay_to_lag.rbnew file mode 100644index 00000000000..1d09d5c484c--- /dev/null+++ b/db/migrate/20240408132459_rename_delay_to_lag.rb@@ -0,0 +1,6 @@+class RenameDelayToLag < ActiveRecord::Migration[7.1]+ def change+ rename_column :relations, :delay, :lag++ end+enddiff --git a/docs/api/apiv3/components/schemas/relation_edit_form_model.yml b/docs/api/apiv3/components/schemas/relation_edit_form_model.ymlindex 1b9fccde69a..64563cbb734 100644--- a/docs/api/apiv3/components/schemas/relation_edit_form_model.yml+++ b/docs/api/apiv3/components/schemas/relation_edit_form_model.yml@@ -21,7 +21,7 @@ example:href: "/api/v3/work_packages/3857"_type: WorkPackagetype: follows- delay: 3+ lag: 3description: let it rest for 3 daysschema:_type: Schema@@ -64,8 +64,8 @@ example:name: To work packagetype: WorkPackagewritable: false- delay:- name: Delay+ lag:+ name: lagtype: Integerwritable: truevalidationErrors:diff --git a/docs/api/apiv3/components/schemas/relation_model.yml b/docs/api/apiv3/components/schemas/relation_model.ymlindex 4a10e966fc9..594937031aa 100644--- a/docs/api/apiv3/components/schemas/relation_model.yml+++ b/docs/api/apiv3/components/schemas/relation_model.yml@@ -20,9 +20,9 @@ properties:description:type: stringdescription: Short text further describing the relation- delay*:+ lag*:type: integer- description: The delay in days between closing of `from` and start of `to`+ description: The lag in days between closing of `from` and start of `to`minimum: 0_links:type: object@@ -131,4 +131,4 @@ example:type: precedesreverseType: followsdescription: We can't bend the steel before it's been delivered!- delay: 0+ lag: 0diff --git a/docs/api/apiv3/components/schemas/relation_schema_model.yml b/docs/api/apiv3/components/schemas/relation_schema_model.ymlindex a30d61a6e49..42353fe1729 100644--- a/docs/api/apiv3/components/schemas/relation_schema_model.yml+++ b/docs/api/apiv3/components/schemas/relation_schema_model.yml@@ -30,7 +30,7 @@ example:name: To work packagetype: WorkPackagewritable: false- delay:- name: Delay+ lag:+ name: Lagtype: Integerwritable: truediff --git a/docs/api/apiv3/components/schemas/relations_model.yml b/docs/api/apiv3/components/schemas/relations_model.ymlindex 1b122604830..5e5e129fedf 100644--- a/docs/api/apiv3/components/schemas/relations_model.yml+++ b/docs/api/apiv3/components/schemas/relations_model.yml@@ -34,4 +34,4 @@ example:type: precedesreverseType: followsdescription: We can't bend the steel before it's been delivered!- delay: 0+ lag: 0diff --git a/docs/api/apiv3/paths/custom_action_execute.yml b/docs/api/apiv3/paths/custom_action_execute.ymlindex 03ca5da47f3..0e8836cc7e2 100644--- a/docs/api/apiv3/paths/custom_action_execute.yml+++ b/docs/api/apiv3/paths/custom_action_execute.yml@@ -72,10 +72,10 @@ post:value:_embedded:details:- attribute: delay+ attribute: lag_type: ErrorerrorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation- message: Delay must be a number greater than or equal to 0+ message: Lag must be a number greater than or equal to 0description: Returned if the custom action was not executed successfully e.g.when a constraint on a work package property was violated.headers: {}diff --git a/docs/api/apiv3/paths/relation.yml b/docs/api/apiv3/paths/relation.ymlindex 4df20e5e90e..8cd725fae4e 100644--- a/docs/api/apiv3/paths/relation.yml+++ b/docs/api/apiv3/paths/relation.yml@@ -91,7 +91,7 @@ get:href: "/api/v3/relations/1"method: PATCH_type: Relation- delay: 0+ lag: 0description: We can't bend the steel before it's been delivered!id: 1name: precedes@@ -157,7 +157,7 @@ patch:href: "/api/v3/relations/1"method: PATCH_type: Relation- delay: 0+ lag: 0description: We can't bend the steel before it's been delivered!id: 1name: precedes@@ -199,10 +199,10 @@ patch:value:_embedded:details:- attribute: delay+ attribute: lag_type: ErrorerrorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation- message: Delay must be a number greater than or equal to 0+ message: Lag must be a number greater than or equal to 0description: |-Returned if:diff --git a/docs/api/apiv3/paths/relation_form.yml b/docs/api/apiv3/paths/relation_form.ymlindex 558d2bbb2e4..7b3481fa2ad 100644--- a/docs/api/apiv3/paths/relation_form.yml+++ b/docs/api/apiv3/paths/relation_form.yml@@ -24,7 +24,7 @@ post:to:href: "/api/v3/work_packages/3857"_type: WorkPackage- delay: 3+ lag: 3description: let it rest for 3 daystype: followsschema:@@ -32,8 +32,8 @@ post:self:href: "/api/v3/relations/schema"_type: Schema- delay:- name: Delay+ lag:+ name: Lagtype: Integerwritable: truedescription:diff --git a/docs/api/apiv3/paths/relations.yml b/docs/api/apiv3/paths/relations.ymlindex c03abba9228..2b60597b3f0 100644--- a/docs/api/apiv3/paths/relations.yml+++ b/docs/api/apiv3/paths/relations.yml@@ -58,7 +58,7 @@ get:href: "/api/v3/relations/1"method: PATCH_type: Relation- delay: 0+ lag: 0description: We can't bend the steel before it's been delivered!id: 1name: precedesdiff --git a/docs/api/apiv3/paths/relations_schema.yml b/docs/api/apiv3/paths/relations_schema.ymlindex f9053d2afa9..2a8ea400221 100644--- a/docs/api/apiv3/paths/relations_schema.yml+++ b/docs/api/apiv3/paths/relations_schema.yml@@ -12,8 +12,8 @@ get:self:href: "/api/v3/relations/schema"_type: Schema- delay:- name: Delay+ lag:+ name: Lagtype: Integerwritable: truedescription:diff --git a/docs/api/apiv3/paths/relations_schema_{type}.yml b/docs/api/apiv3/paths/relations_schema_{type}.ymlindex 0ddafe2e5f4..417e1e01889 100644--- a/docs/api/apiv3/paths/relations_schema_{type}.yml+++ b/docs/api/apiv3/paths/relations_schema_{type}.yml@@ -20,8 +20,8 @@ get:self:href: "/api/v3/relations/schema"_type: Schema- delay:- name: Delay+ lag:+ name: Lagtype: Integerwritable: truedescription:diff --git a/docs/api/apiv3/paths/work_package_relations.yml b/docs/api/apiv3/paths/work_package_relations.ymlindex bb3efd2b36c..35900c5d394 100644--- a/docs/api/apiv3/paths/work_package_relations.yml+++ b/docs/api/apiv3/paths/work_package_relations.yml@@ -88,10 +88,10 @@ post:value:_embedded:details:- attribute: delay+ attribute: lag_type: ErrorerrorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation- message: Delay must be a number greater than or equal to 0+ message: Lag must be a number greater than or equal to 0description: |-Returned if:diff --git a/docs/api/apiv3/tags/relations.yml b/docs/api/apiv3/tags/relations.ymlindex 6e437393dee..51b19355c0c 100644--- a/docs/api/apiv3/tags/relations.yml+++ b/docs/api/apiv3/tags/relations.yml@@ -14,7 +14,7 @@ description: |-| type || reverseType || description |- | delay |+ | lag |+--------------+```@@ -44,7 +44,7 @@ description: |-| type | Which kind of relation (blocks, precedes, etc.) | String | in: relates, duplicates, duplicated, blocks, blocked, precedes, follows, includes, partof, requires, required | READ / WRITE || reverseType | The kind of relation from the other WP's perspective | String | in: relates, duplicates, duplicated, blocks, blocked, precedes, follows, includes, partof, requires, required | READ || description | Short text further describing the relation | String | | READ / WRITE |- | delay* | The delay in days between closing of `from` and start of `to` | Integer | x >= 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 schemaendpoint at `/api/v3/relations/schema/{type}`.diff --git a/lib/api/v3/relations/relation_representer.rb b/lib/api/v3/relations/relation_representer.rbindex 3c4556c1f15..e14d0556193 100644--- a/lib/api/v3/relations/relation_representer.rb+++ b/lib/api/v3/relations/relation_representer.rb@@ -61,8 +61,8 @@ module APIproperty :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 updatediff --git a/lib/services/create_relation.rb b/lib/services/create_relation.rbindex e9491493363..351113d8c38 100644--- a/lib/services/create_relation.rb+++ b/lib/services/create_relation.rb@@ -31,7 +31,7 @@ class Services::CreateRelation@relation = from_work_package.new_relation.tap do |r|r.to = to_work_packager.relation_type = attrs[:relation_type]- r.delay = attrs[:delay]+ r.lag = attrs[:lag]endenddiff --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.rbindex d9b4f9cf446..255075b34f8 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 @@ module XlsExport::WorkPackage::Exporterdef 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_columnsend@@ -149,7 +149,7 @@ module XlsExport::WorkPackage::Exporterdef with_relations_headers[Relation.human_attribute_name(:relation_type),- Relation.human_attribute_name(:delay),+ Relation.human_attribute_name(:lag),Relation.human_attribute_name(:description)]enddiff --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.rbindex 7112e3447bf..7b35482de9a 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 @@ RSpec.describe XlsExport::WorkPackage::Exporter::XLS doexpect(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 @@ RSpec.describe XlsExport::WorkPackage::Exporter::XLS donil, 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 recordexpect(sheet.row(SINGLE)).to eq [diff --git a/spec/contracts/relations/create_contract_spec.rb b/spec/contracts/relations/create_contract_spec.rbindex 47cd3de84b0..36fd4941508 100644--- a/spec/contracts/relations/create_contract_spec.rb+++ b/spec/contracts/relations/create_contract_spec.rb@@ -35,7 +35,7 @@ RSpec.describe Relations::CreateContract doRelation.new from: relation_from,to: relation_to,relation_type:,- delay: relation_delay+ lag: relation_lagendendenddiff --git a/spec/contracts/relations/shared_contract_examples.rb b/spec/contracts/relations/shared_contract_examples.rbindex 175801fd373..ab8153029c8 100644--- a/spec/contracts/relations/shared_contract_examples.rb+++ b/spec/contracts/relations/shared_contract_examples.rb@@ -51,7 +51,7 @@ RSpec.shared_examples_for "relation contract" dolet(:relation_type) doRelation::TYPE_RELATESend- let(:relation_delay) { 42 }+ let(:relation_lag) { 42 }let!(:wp_visible_scope) doinstance_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.rbindex d8c925dd095..c18527dd625 100644--- a/spec/contracts/relations/update_contract_spec.rb+++ b/spec/contracts/relations/update_contract_spec.rb@@ -36,7 +36,7 @@ RSpec.describe Relations::UpdateContract dofrom: relation_from,to: relation_to,relation_type:,- delay: relation_delay)+ lag: relation_lag)endenddiff --git a/spec/factories/relation_factory.rb b/spec/factories/relation_factory.rbindex dfb814b572e..e3b96d33b85 100644--- a/spec/factories/relation_factory.rb+++ b/spec/factories/relation_factory.rb@@ -31,12 +31,12 @@ FactoryBot.define dofrom factory: :work_packageto { build(:work_package, project: from.project) }relation_type { "relates" } # "relates", "duplicates", "duplicated", "blocks", "blocked", "precedes", "follows"- delay { nil }+ lag { nil }description { nil }endfactory :follows_relation, parent: :relation dorelation_type { "follows" }- delay { 0 }+ lag { 0 }endenddiff --git a/spec/lib/api/v3/relations/relation_representer_spec.rb b/spec/lib/api/v3/relations/relation_representer_spec.rbindex 13f313fefb6..318ff6dd1f9 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 @@ RSpec.describe API::V3::Relations::RelationRepresenter dolet(:type) { "follows" }let(:description) { "This first" }- let(:delay) { 3 }+ let(:lag) { 3 }let(:relation) dobuild_stubbed(:relation,@@ -44,7 +44,7 @@ RSpec.describe API::V3::Relations::RelationRepresenter doto:,relation_type: type,description:,- delay:)+ lag:)endlet(:representer) { described_class.new relation, current_user: user }@@ -79,7 +79,7 @@ RSpec.describe API::V3::Relations::RelationRepresenter do"type" => "follows","reverseType" => "precedes","description" => description,- "delay" => delay+ "lag" => lag}end@@ -95,9 +95,9 @@ RSpec.describe API::V3::Relations::RelationRepresenter doexpect(rel.from_id).to eq from.id.to_sexpect(rel.to_id).to eq to.id.to_s- expect(rel.delay).to eq delay+ expect(rel.lag).to eq lagexpect(rel.relation_type).to eq typeexpect(rel.description).to eq description- expect(rel.delay).to eq delay+ expect(rel.lag).to eq lagendenddiff --git a/spec/models/relation_spec.rb b/spec/models/relation_spec.rbindex 312e9a2ae05..5926a5853e1 100644--- a/spec/models/relation_spec.rb+++ b/spec/models/relation_spec.rb@@ -77,7 +77,7 @@ RSpec.describe Relation doendit "fails validation with invalid date and reverses" do- relation.delay = "xx"+ relation.lag = "xx"expect(relation).not_to be_validexpect(relation.save).to be(false)@@ -170,16 +170,16 @@ RSpec.describe Relation doendend- context "with a follows relation with a delay" do+ context "with a follows relation with a lag" dolet_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 3CHART- it "returns predecessor due_date + delay + 1" do+ it "returns predecessor due_date + lag + 1" dorelation_a = schedule.follows_relation(from: "follower_a", to: "main")expect(relation_a.successor_soonest_start).to eq(schedule.tuesday)@@ -191,57 +191,57 @@ RSpec.describe Relation doendend- 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" dolet_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 3CHART- 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" doset_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)endend- 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" dolet_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 weekendsCHART- 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)" doset_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)endendenddiff --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.rbindex d1aea82e552..8c38183c4a0 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 @@ RSpec.describe WorkPackages::Scopes::CoveringDatesAndDaysOfWeek do.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" docreate_schedule(<<~CHART)days | MTWTFSS |not_covered1 | X |- follower1 | X | follows not_covered1 with delay 3+ follower1 | X | follows not_covered1 with lag 3not_covered2 | X |- follower2 | X | follows not_covered2 with delay 1+ follower2 | X | follows not_covered2 with lag 1CHARTexpect(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.rbindex fbb1d59d380..a64fbbb3a4d 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 @@ RSpec.describe "API v3 Relation resource", content_type: :json dolet(:type) { "follows" }let(:description) { "This first" }- let(:delay) { 3 }+ let(:lag) { 3 }let(:params) do{@@ -53,7 +53,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json do},type:,description:,- delay:+ lag:}endlet(:relation) do@@ -62,7 +62,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json doto:,relation_type: type,description:,- delay:)+ lag:)endbefore do@@ -78,7 +78,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json doexpect(rel.to).to eq toexpect(rel.relation_type).to eq typeexpect(rel.description).to eq description- expect(rel.delay).to eq delay+ expect(rel.lag).to eq lagendend@@ -226,12 +226,12 @@ RSpec.describe "API v3 Relation resource", content_type: :json dodescribe "updating a relation" dolet(: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 @@ RSpec.describe "API v3 Relation resource", content_type: :json doexpect(relation.reload.description).to eq new_descriptionend- 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_lagendit "returns the updated relation" dodiff --git a/spec/services/relations/create_service_spec.rb b/spec/services/relations/create_service_spec.rbindex 6d2371a621b..fdf39d5051a 100644--- a/spec/services/relations/create_service_spec.rb+++ b/spec/services/relations/create_service_spec.rb@@ -35,7 +35,7 @@ RSpec.describe Relations::CreateService dolet(:work_package2_due_date) { nil }let(:follows_relation) { false }- let(:delay) { 3 }+ let(:lag) { 3 }let(:work_package1) dobuild_stubbed(:work_package,@@ -63,7 +63,7 @@ RSpec.describe Relations::CreateService do{to: work_package1,from: work_package2,- delay:+ lag:}enddiff --git a/spec/services/relations/update_service_spec.rb b/spec/services/relations/update_service_spec.rbindex e008a6ef57f..7868ae19d1b 100644--- a/spec/services/relations/update_service_spec.rb+++ b/spec/services/relations/update_service_spec.rb@@ -35,7 +35,7 @@ RSpec.describe Relations::UpdateService dolet(:work_package2_due_date) { nil }let(:follows_relation) { false }- let(:delay) { 3 }+ let(:lag) { 3 }let(:work_package1) dobuild_stubbed(:work_package,@@ -63,7 +63,7 @@ RSpec.describe Relations::UpdateService do{to: work_package1,from: work_package2,- delay:+ lag:}enddiff --git a/spec/services/work_packages/set_schedule_service_spec.rb b/spec/services/work_packages/set_schedule_service_spec.rbindex 1ddef14287c..8062b24e560 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 @@ RSpec.describe WorkPackages::SetScheduleService dolet(: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) docreate_follower(follower1_start_date,follower1_due_date,- { work_package => follower1_delay })+ { work_package => follower1_lag })endlet(: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) docreate_follower(follower2_start_date,follower2_due_date,- { following_work_package1 => follower2_delay })+ { following_work_package1 => follower2_lag })endlet(: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) docreate_follower(follower3_start_date,follower3_due_date,- { following_work_package2 => follower3_delay })+ { following_work_package2 => follower3_lag })endlet(:parent_follower1_start_date) { follower1_start_date }@@ -93,9 +93,9 @@ RSpec.describe WorkPackages::SetScheduleService dodue_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 @@ RSpec.describe WorkPackages::SetScheduleService doit_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' dolet(: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 dowork_package.due_date = Time.zone.today + 5.days@@ -421,7 +421,7 @@ RSpec.describe WorkPackages::SetScheduleService dolet(:following_work_package1) docreate_follower(follower1_start_date,follower1_due_date,- { work_package => follower1_delay,+ { work_package => follower1_lag,another_successor => 0 })endlet(:another_successor) do@@ -743,20 +743,20 @@ RSpec.describe WorkPackages::SetScheduleService docontext 'with a chain of successors with two paths leading to the same work package in the end' dolet(: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) docreate_follower(follower3_start_date,follower3_due_date,- { work_package => follower3_delay })+ { work_package => follower3_lag })endlet(: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) docreate_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 })endlet!(: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.rbindex 2d7f1a9f1b9..ae53f37c86a 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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" doendend- context "with the follower having some space left and a delay" do+ context "with the follower having some space left and a lag" dolet_schedule(<<~CHART)days | MTWTFSSmtwtfss |work_package | X |- follower | XXX | follows work_package with delay 3+ follower | XXX | follows work_package with lag 3CHARTbefore do@@ -268,7 +268,7 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" doCHARTend- it "reschedules the follower to start after the delay" do+ it "reschedules the follower to start after the lag" doexpect_schedule(subject.all_results, <<~CHART)| MTWTFSSmtwtfss |work_package | XXXXX..X |@@ -277,11 +277,11 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" doendend- context "with the follower having a delay overlapping non-working days" do+ context "with the follower having a lag overlapping non-working days" dolet_schedule(<<~CHART)days | MTWTFSS |work_package | X |- follower | XX | follows work_package with delay 2+ follower | XX | follows work_package with lag 2CHARTbefore do@@ -291,7 +291,7 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" doCHARTend- 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" doexpect(subject.all_results).to match_schedule(<<~CHART)| MTWTFSSmtwt |work_package | X |@@ -350,7 +350,7 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" dolet_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 2annoyer | XX..XX |CHART@@ -943,12 +943,12 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" doendend- 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" dolet_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 3follower3 | XXX..XX | follows follower2follower4 | XX | follows follower3CHART@@ -960,7 +960,7 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" doCHARTend- 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" doexpect(subject.all_results).to match_schedule(<<~CHART)days | MTWTFSSm sm sm sm |work_package | ] |@@ -994,7 +994,7 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" doCHARTend- 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" doexpect(subject.all_results).to match_schedule(<<~CHART)days | MTWTFSSm w m |work_package | X.X |@@ -1125,7 +1125,7 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" dolet_schedule(<<~CHART)days | MTWTFSS |work_package | |- new_parent | | follows new_parent_predecessor with delay 3+ new_parent | | follows new_parent_predecessor with lag 3new_parent_predecessor | X |CHART@@ -1147,7 +1147,7 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" dolet_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 3new_parent_predecessor | X |CHART@@ -1170,7 +1170,7 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" dolet_schedule(<<~CHART)days | MTWTFSS |work_package | ] |- new_parent | | follows new_parent_predecessor with delay 3+ new_parent | | follows new_parent_predecessor with lag 3new_parent_predecessor | X |CHART@@ -1192,7 +1192,7 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" dolet_schedule(<<~CHART)days | MTWTFSS |work_package | ] |- new_parent | | follows new_parent_predecessor with delay 3+ new_parent | | follows new_parent_predecessor with lag 3new_parent_predecessor | X |CHART@@ -1214,7 +1214,7 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" dolet_schedule(<<~CHART)days | MTWTFSS |work_package | XX |- new_parent | | follows new_parent_predecessor with delay 3+ new_parent | | follows new_parent_predecessor with lag 3new_parent_predecessor | X |CHARTdiff --git a/spec/services/work_packages/shared/all_days_spec.rb b/spec/services/work_packages/shared/all_days_spec.rbindex b131e121482..b74103033b1 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 @@ RSpec.describe WorkPackages::Shared::AllDays doexpect(subject.soonest_working_day(nil)).to be_nilend- 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))endend@@ -155,8 +155,8 @@ RSpec.describe WorkPackages::Shared::AllDays doexpect(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)endend@@ -165,8 +165,8 @@ RSpec.describe WorkPackages::Shared::AllDays doexpect(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)endenddiff --git a/spec/services/work_packages/shared/shared_examples_days.rb b/spec/services/work_packages/shared/shared_examples_days.rbindex 0f652d74615..29033a2ee64 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 @@ RSpec.shared_examples "soonest working day" do |date:, expected:|endend-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)endenddiff --git a/spec/services/work_packages/shared/working_days_spec.rb b/spec/services/work_packages/shared/working_days_spec.rbindex 3835cd50529..a2be2810338 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 @@ RSpec.describe WorkPackages::Shared::WorkingDays doexpect(subject.soonest_working_day(nil)).to be_nilend- 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_errorendend@@ -208,18 +208,18 @@ RSpec.describe WorkPackages::Shared::WorkingDays doinclude_examples "soonest working day", date: sunday_2022_07_31, expected: monday_2022_08_01include_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)endend@@ -228,8 +228,8 @@ RSpec.describe WorkPackages::Shared::WorkingDays doinclude_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)endenddiff --git a/spec/support/schedule_helpers/chart.rb b/spec/support/schedule_helpers/chart.rbindex 42124c5ce4c..503603511c0 100644--- a/spec/support/schedule_helpers/chart.rb+++ b/spec/support/schedule_helpers/chart.rb@@ -87,7 +87,7 @@ module ScheduleHelperschart.first_day = first_daychart.last_day = last_daychart.predecessors_by_followers = predecessors_by_followers- chart.delays_between = delays_between+ chart.lags_between = lags_betweenchart.parent_by_child = parent_by_childchartend@@ -129,8 +129,8 @@ module ScheduleHelperspredecessors_by_followers[follower]end- def delay_between(predecessor:, follower:)- delays_between.fetch([predecessor, follower])+ def lag_between(predecessor:, follower:)+ lags_between.fetch([predecessor, follower])enddef add_work_package(attributes)@@ -160,9 +160,9 @@ module ScheduleHelpersattributes[:ignore_non_working_days] = ignore_non_working_daysend- 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]] = lagenddef add_parent_relation(parent:, child:)@@ -200,7 +200,7 @@ module ScheduleHelpers:first_day,:last_day,:predecessors_by_followers,- :delays_between,+ :lags_between,:parent_by_childprivate@@ -252,8 +252,8 @@ module ScheduleHelpers@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)enddef parent_by_childdiff --git a/spec/support/schedule_helpers/chart_builder.rb b/spec/support/schedule_helpers/chart_builder.rbindex 3d71625d939..e7fcafe3ab6 100644--- a/spec/support/schedule_helpers/chart_builder.rb+++ b/spec/support/schedule_helpers/chart_builder.rb@@ -101,11 +101,11 @@ module ScheduleHelpersdef 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 @@ module ScheduleHelpersspell_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.rbindex 739ca4d79e2..bc0f88e71cf 100644--- a/spec/support/schedule_helpers/example_methods.rb+++ b/spec/support/schedule_helpers/example_methods.rb@@ -46,7 +46,7 @@ module ScheduleHelpers# 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.rbindex 3d4ad1b747a..f85ea86fca4 100644--- a/spec/support/schedule_helpers/schedule_builder.rb+++ b/spec/support/schedule_helpers/schedule_builder.rb@@ -61,7 +61,7 @@ module ScheduleHelpersFactoryBot.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:))endenddiff --git a/spec/support_spec/schedule_helpers/chart_builder_spec.rb b/spec/support_spec/schedule_helpers/chart_builder_spec.rbindex 096dd94a5d2..b73a33dbb0e 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 @@ RSpec.describe ScheduleHelpers::ChartBuilder dofollower | | follows mainCHARTexpect(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)endit "can be declared in any order" do@@ -117,19 +117,19 @@ RSpec.describe ScheduleHelpers::ChartBuilder domain | |CHARTexpect(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)endend- describe "follows <name> with delay <n>" do- it "adds a follows relation to the named with a delay" do+ describe "follows <name> with lag <n>" do+ it "adds a follows relation to the named with a lag" dochart = builder.parse(<<~CHART)days | MTWTFSS |main | |- follower | | follows main with delay 3+ follower | | follows main with lag 3CHARTexpect(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)endenddiff --git a/spec/support_spec/schedule_helpers/example_methods_spec.rb b/spec/support_spec/schedule_helpers/example_methods_spec.rbindex 2f29d72f65a..cb01a9bcb09 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 @@ RSpec.describe ScheduleHelpers::ExampleMethods doschedule = create_schedule(<<~CHART)days | MTWTFSS |predecessor | XX |- follower | X | follows predecessor with delay 2+ follower | X | follows predecessor with lag 2CHARTexpect(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.rbindex 030b18d6d80..a6e9f8b4d18 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 @@ RSpec.describe ScheduleHelpers::LetSchedule dolet_schedule(<<~CHART)days | MTWTFSS |main | XX |- follower | XXX | follows main with delay 2+ follower | XXX | follows main with lag 2child | | child of mainCHARTdiff --git a/spec/workers/work_packages/apply_working_days_change_job_spec.rb b/spec/workers/work_packages/apply_working_days_change_job_spec.rbindex e296de7ca97..5588405c4f6 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 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob doendend- 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" dolet_schedule(<<~CHART)days | MTWTFSS |predecessor | XX ░░ |- follower | X ░░ | follows predecessor with delay 1+ follower | X ░░ | follows predecessor with lag 1CHARTbefore doset_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" dosubjectexpect(WorkPackage.all).to match_schedule(<<~CHART)days | MTWTFSS |@@ -243,11 +243,11 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob doendend- context "with work packages without dates following each other with delay" do+ context "with work packages without dates following each other with lag" dolet_schedule(<<~CHART)days | MTWTFSS |predecessor | ░░ |- follower | ░░ | follows predecessor with delay 5+ follower | ░░ | follows predecessor with lag 5CHARTbefore do@@ -270,11 +270,11 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob doendend- 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" dolet_schedule(<<~CHART)days | MTWTFSS |predecessor | X ░ ░░ |- follower | ░ X░░ | follows predecessor with delay 2+ follower | ░ X░░ | follows predecessor with lag 2CHARTlet(:work_week) { set_work_week("monday", "tuesday", "thursday", "friday") }@@ -753,18 +753,18 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob doendend- 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" dolet_schedule(<<~CHART)days | MTWTFSS |predecessor | XX ░░ |- follower | X ░░ | follows predecessor with delay 1+ follower | X ░░ | follows predecessor with lag 1CHARTbefore doset_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" dosubjectexpect(WorkPackage.all).to match_schedule(<<~CHART)days | MTWTFSS |@@ -789,11 +789,11 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob doendend- context "with work packages without dates following each other with delay" do+ context "with work packages without dates following each other with lag" dolet_schedule(<<~CHART)days | MTWTFSS |predecessor | ░░ |- follower | ░░ | follows predecessor with delay 5+ follower | ░░ | follows predecessor with lag 5CHARTbefore do@@ -816,11 +816,11 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob doendend- 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" dolet_schedule(<<~CHART)days | MTWTFSS |predecessor | X ░ ░░ |- follower | ░ X░░ | follows predecessor with delay 2+ follower | ░ X░░ | follows predecessor with lag 2CHARTlet(:non_working_day) { create(:non_working_day, date: next_monday.next_occurring(:wednesday)) }@@ -1355,18 +1355,18 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob doendend- 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" dolet_schedule(<<~CHART)days | MTWTFSS |predecessor | XX ░░ |- follower | X ░░ | follows predecessor with delay 1+ follower | X ░░ | follows predecessor with lag 1CHARTbefore doset_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" dosubjectexpect(WorkPackage.all).to match_schedule(<<~CHART)days | MTWTFSS |@@ -1391,11 +1391,11 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob doendend- context "with work packages without dates following each other with delay" do+ context "with work packages without dates following each other with lag" dolet_schedule(<<~CHART)days | MTWTFSS |predecessor | ░░ |- follower | ░░ | follows predecessor with delay 5+ follower | ░░ | follows predecessor with lag 5CHARTbefore do