Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Rename delay to lag

Oliver Günthere3e8d7897216
diff --git a/app/contracts/relations/base_contract.rb b/app/contracts/relations/base_contract.rb
index 2a1ddc9d705..24b9b23e0ce 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 377fae809f4..a39f733dad7 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 @@ class Relation < ApplicationRecord
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 @@ class Relation < ApplicationRecord
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 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/28
diff --git a/app/services/relations/base_service.rb b/app/services/relations/base_service.rb
index 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::BaseCallable
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 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 WorkPackages
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 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 WorkPackages
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 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 < ApplicationJob
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 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.rb
new file mode 100644
index 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
+end
diff --git a/docs/api/apiv3/components/schemas/relation_edit_form_model.yml b/docs/api/apiv3/components/schemas/relation_edit_form_model.yml
index 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: WorkPackage
type: follows
- delay: 3
+ lag: 3
description: let it rest for 3 days
schema:
_type: Schema
@@ -64,8 +64,8 @@ example:
name: To work package
type: WorkPackage
writable: false
- delay:
- name: Delay
+ lag:
+ name: lag
type: Integer
writable: true
validationErrors:
diff --git a/docs/api/apiv3/components/schemas/relation_model.yml b/docs/api/apiv3/components/schemas/relation_model.yml
index 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: string
description: 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: precedes
reverseType: follows
description: We can't bend the steel before it's been delivered!
- delay: 0
+ lag: 0
diff --git a/docs/api/apiv3/components/schemas/relation_schema_model.yml b/docs/api/apiv3/components/schemas/relation_schema_model.yml
index 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 package
type: WorkPackage
writable: false
- delay:
- name: Delay
+ lag:
+ name: Lag
type: Integer
writable: true
diff --git a/docs/api/apiv3/components/schemas/relations_model.yml b/docs/api/apiv3/components/schemas/relations_model.yml
index 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: precedes
reverseType: follows
description: We can't bend the steel before it's been delivered!
- delay: 0
+ lag: 0
diff --git a/docs/api/apiv3/paths/custom_action_execute.yml b/docs/api/apiv3/paths/custom_action_execute.yml
index 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: Error
errorIdentifier: 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 0
description: 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.yml
index 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: 0
description: We can't bend the steel before it's been delivered!
id: 1
name: precedes
@@ -157,7 +157,7 @@ patch:
href: "/api/v3/relations/1"
method: PATCH
_type: Relation
- delay: 0
+ lag: 0
description: We can't bend the steel before it's been delivered!
id: 1
name: precedes
@@ -199,10 +199,10 @@ patch:
value:
_embedded:
details:
- attribute: delay
+ attribute: lag
_type: Error
errorIdentifier: 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 0
description: |-
Returned if:
diff --git a/docs/api/apiv3/paths/relation_form.yml b/docs/api/apiv3/paths/relation_form.yml
index 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: 3
description: let it rest for 3 days
type: follows
schema:
@@ -32,8 +32,8 @@ post:
self:
href: "/api/v3/relations/schema"
_type: Schema
- delay:
- name: Delay
+ lag:
+ name: Lag
type: Integer
writable: true
description:
diff --git a/docs/api/apiv3/paths/relations.yml b/docs/api/apiv3/paths/relations.yml
index 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: 0
description: We can't bend the steel before it's been delivered!
id: 1
name: precedes
diff --git a/docs/api/apiv3/paths/relations_schema.yml b/docs/api/apiv3/paths/relations_schema.yml
index 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: Lag
type: Integer
writable: true
description:
diff --git a/docs/api/apiv3/paths/relations_schema_{type}.yml b/docs/api/apiv3/paths/relations_schema_{type}.yml
index 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: Lag
type: Integer
writable: true
description:
diff --git a/docs/api/apiv3/paths/work_package_relations.yml b/docs/api/apiv3/paths/work_package_relations.yml
index 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: Error
errorIdentifier: 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 0
description: |-
Returned if:
diff --git a/docs/api/apiv3/tags/relations.yml b/docs/api/apiv3/tags/relations.yml
index 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 schema
endpoint at `/api/v3/relations/schema/{type}`.
diff --git a/lib/api/v3/relations/relation_representer.rb b/lib/api/v3/relations/relation_representer.rb
index 3c4556c1f15..e14d0556193 100644
--- a/lib/api/v3/relations/relation_representer.rb
+++ b/lib/api/v3/relations/relation_representer.rb
@@ -61,8 +61,8 @@ module API
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 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_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 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::Exporter
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 @@ module XlsExport::WorkPackage::Exporter
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 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 do
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 @@ RSpec.describe XlsExport::WorkPackage::Exporter::XLS do
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 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 do
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 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" do
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 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 do
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 dfb814b572e..e3b96d33b85 100644
--- a/spec/factories/relation_factory.rb
+++ b/spec/factories/relation_factory.rb
@@ -31,12 +31,12 @@ FactoryBot.define do
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 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 do
let(:type) { "follows" }
let(:description) { "This first" }
- let(:delay) { 3 }
+ let(:lag) { 3 }
let(:relation) do
build_stubbed(:relation,
@@ -44,7 +44,7 @@ RSpec.describe API::V3::Relations::RelationRepresenter do
to:,
relation_type: type,
description:,
- delay:)
+ lag:)
end
let(: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 do
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 312e9a2ae05..5926a5853e1 100644
--- a/spec/models/relation_spec.rb
+++ b/spec/models/relation_spec.rb
@@ -77,7 +77,7 @@ RSpec.describe Relation do
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 @@ RSpec.describe Relation do
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 @@ RSpec.describe Relation do
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 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" 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 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 do
let(: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:
}
end
let(:relation) do
@@ -62,7 +62,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json do
to:,
relation_type: type,
description:,
- delay:)
+ lag:)
end
before do
@@ -78,7 +78,7 @@ RSpec.describe "API v3 Relation resource", content_type: :json do
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 @@ RSpec.describe "API v3 Relation resource", content_type: :json do
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 @@ RSpec.describe "API v3 Relation resource", content_type: :json do
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 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 do
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 @@ RSpec.describe Relations::CreateService do
{
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 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 do
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 @@ RSpec.describe Relations::UpdateService do
{
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 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 do
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 @@ RSpec.describe WorkPackages::SetScheduleService do
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 @@ RSpec.describe WorkPackages::SetScheduleService do
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 @@ RSpec.describe WorkPackages::SetScheduleService do
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 @@ RSpec.describe WorkPackages::SetScheduleService do
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 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" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 @@ RSpec.describe WorkPackages::SetScheduleService, "working days" do
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 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 do
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 @@ RSpec.describe WorkPackages::Shared::AllDays do
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 @@ RSpec.describe WorkPackages::Shared::AllDays do
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 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:|
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 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 do
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 @@ RSpec.describe WorkPackages::Shared::WorkingDays do
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 @@ RSpec.describe WorkPackages::Shared::WorkingDays do
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 42124c5ce4c..503603511c0 100644
--- a/spec/support/schedule_helpers/chart.rb
+++ b/spec/support/schedule_helpers/chart.rb
@@ -87,7 +87,7 @@ module ScheduleHelpers
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 @@ module ScheduleHelpers
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 @@ module ScheduleHelpers
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 @@ module ScheduleHelpers
:first_day,
:last_day,
:predecessors_by_followers,
- :delays_between,
+ :lags_between,
:parent_by_child
private
@@ -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)
end
def parent_by_child
diff --git a/spec/support/schedule_helpers/chart_builder.rb b/spec/support/schedule_helpers/chart_builder.rb
index 3d71625d939..e7fcafe3ab6 100644
--- a/spec/support/schedule_helpers/chart_builder.rb
+++ b/spec/support/schedule_helpers/chart_builder.rb
@@ -101,11 +101,11 @@ module ScheduleHelpers
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 @@ module ScheduleHelpers
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 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.rb
index 3d4ad1b747a..f85ea86fca4 100644
--- a/spec/support/schedule_helpers/schedule_builder.rb
+++ b/spec/support/schedule_helpers/schedule_builder.rb
@@ -61,7 +61,7 @@ module ScheduleHelpers
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 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 do
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 @@ RSpec.describe ScheduleHelpers::ChartBuilder do
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 <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" 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 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 do
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 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 do
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 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 do
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 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob do
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 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob do
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 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob do
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 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob do
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 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob do
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 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob do
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 @@ RSpec.describe WorkPackages::ApplyWorkingDaysChangeJob do
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