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 end_date/end_gate to finish_date/finish_gate

ulferts005d93b1576d
diff --git a/app/components/projects/life_cycle_component.rb b/app/components/projects/life_cycle_component.rb
index 31cc8acd650..f96e1453c73 100644
--- a/app/components/projects/life_cycle_component.rb
+++ b/app/components/projects/life_cycle_component.rb
@@ -36,12 +36,12 @@ module Projects
# Settings::ProjectLifeCycleStepDefinitions::RowComponent.
# It should hold the icon, definition name and gate text information.
def text
- if model.start_gate? && model.end_gate?
+ if model.start_gate? && model.finish_gate?
I18n.t("settings.project_phase_definitions.both_gate")
elsif model.start_gate?
I18n.t("settings.project_phase_definitions.start_gate")
- elsif model.end_gate?
- I18n.t("settings.project_phase_definitions.end_gate")
+ elsif model.finish_gate?
+ I18n.t("settings.project_phase_definitions.finish_gate")
else
I18n.t("settings.project_phase_definitions.no_gate")
end
diff --git a/app/components/projects/life_cycle_step_definitions/form_component.html.erb b/app/components/projects/life_cycle_step_definitions/form_component.html.erb
index 318b5a8f012..e9fb8fbae31 100644
--- a/app/components/projects/life_cycle_step_definitions/form_component.html.erb
+++ b/app/components/projects/life_cycle_step_definitions/form_component.html.erb
@@ -63,9 +63,9 @@ See COPYRIGHT and LICENSE files for more details.
end
gates_tab.with_row(
mt: 2,
- classes: model.end_gate.blank? ? "d-none" : "",
+ classes: model.finish_gate.blank? ? "d-none" : "",
data: {
- target_name: "end_gate",
+ target_name: "finish_gate",
"show-when-checked-target": "effect",
visibility_class: "d-none"
}
diff --git a/app/components/projects/phase_component.rb b/app/components/projects/phase_component.rb
index ea5c4471534..93f56f23aa2 100644
--- a/app/components/projects/phase_component.rb
+++ b/app/components/projects/phase_component.rb
@@ -46,8 +46,8 @@ module Projects
end
def finish_date
- if phase.end_date.present?
- helpers.format_date(phase.end_date)
+ if phase.finish_date.present?
+ helpers.format_date(phase.finish_date)
else
helpers.t("js.label_no_due_date")
end
@@ -58,7 +58,7 @@ module Projects
end
def display_finish_gate?
- phase.end_gate? && phase.end_date.present?
+ phase.finish_gate? && phase.finish_date.present?
end
def gate_icon
diff --git a/app/components/projects/settings/life_cycle_steps/step_component.rb b/app/components/projects/settings/life_cycle_steps/step_component.rb
index 5d395d203f2..08a2cf32264 100644
--- a/app/components/projects/settings/life_cycle_steps/step_component.rb
+++ b/app/components/projects/settings/life_cycle_steps/step_component.rb
@@ -48,12 +48,12 @@ module Projects
end
def gate_info
- if definition.start_gate? && definition.end_gate?
+ if definition.start_gate? && definition.finish_gate?
I18n.t("settings.project_phase_definitions.both_gate")
elsif definition.start_gate?
I18n.t("settings.project_phase_definitions.start_gate")
- elsif definition.end_gate?
- I18n.t("settings.project_phase_definitions.end_gate")
+ elsif definition.finish_gate?
+ I18n.t("settings.project_phase_definitions.finish_gate")
else
I18n.t("settings.project_phase_definitions.no_gate")
end
diff --git a/app/components/settings/project_life_cycle_step_definitions/row_component.rb b/app/components/settings/project_life_cycle_step_definitions/row_component.rb
index f7777cb91dc..7f92dd5684f 100644
--- a/app/components/settings/project_life_cycle_step_definitions/row_component.rb
+++ b/app/components/settings/project_life_cycle_step_definitions/row_component.rb
@@ -50,12 +50,12 @@ module Settings
end
def gate_info
- if definition.start_gate? && definition.end_gate?
+ if definition.start_gate? && definition.finish_gate?
I18n.t("settings.project_phase_definitions.both_gate")
elsif definition.start_gate?
I18n.t("settings.project_phase_definitions.start_gate")
- elsif definition.end_gate?
- I18n.t("settings.project_phase_definitions.end_gate")
+ elsif definition.finish_gate?
+ I18n.t("settings.project_phase_definitions.finish_gate")
else
I18n.t("settings.project_phase_definitions.no_gate")
end
diff --git a/app/contracts/project_life_cycle_steps/base_contract.rb b/app/contracts/project_life_cycle_steps/base_contract.rb
index c791623d2a3..6d6b4c552c7 100644
--- a/app/contracts/project_life_cycle_steps/base_contract.rb
+++ b/app/contracts/project_life_cycle_steps/base_contract.rb
@@ -63,12 +63,12 @@ module ProjectLifeCycleSteps
step.start_date
end
- def end_date_for(step)
- step.end_date || step.start_date # Use the start_date as fallback for single date stages
+ def finish_date_for(step)
+ step.finish_date || step.start_date # Use the start_date as fallback for single date stages
end
def has_invalid_dates?(previous_step, current_step)
- start_date_for(current_step) <= end_date_for(previous_step)
+ start_date_for(current_step) <= finish_date_for(previous_step)
end
end
end
diff --git a/app/controllers/admin/settings/project_life_cycle_definitions_controller.rb b/app/controllers/admin/settings/project_life_cycle_definitions_controller.rb
index 416da0ed265..38c7f2e6948 100644
--- a/app/controllers/admin/settings/project_life_cycle_definitions_controller.rb
+++ b/app/controllers/admin/settings/project_life_cycle_definitions_controller.rb
@@ -129,9 +129,9 @@ module Admin::Settings
name
color_id
start_gate_name
- end_gate_name
+ finish_gate_name
start_gate
- end_gate])
+ finish_gate])
end
def update_definitions_via_turbo_stream
diff --git a/app/forms/projects/life_cycle_step_definitions/finish_gate_checkbox_form.rb b/app/forms/projects/life_cycle_step_definitions/finish_gate_checkbox_form.rb
index 0a4d4f043ef..dfeebbfe3b3 100644
--- a/app/forms/projects/life_cycle_step_definitions/finish_gate_checkbox_form.rb
+++ b/app/forms/projects/life_cycle_step_definitions/finish_gate_checkbox_form.rb
@@ -32,13 +32,13 @@ module Projects::LifeCycleStepDefinitions
class FinishGateCheckboxForm < ApplicationForm
form do |f|
f.check_box(
- label: attribute_name(:end_gate),
- name: :end_gate,
- caption: I18n.t("settings.project_phase_definitions.end_gate_caption"),
+ label: attribute_name(:finish_gate),
+ name: :finish_gate,
+ caption: I18n.t("settings.project_phase_definitions.finish_gate_caption"),
input_width: :medium,
data: {
"show-when-checked-target": "cause",
- target_name: "end_gate"
+ target_name: "finish_gate"
}
)
end
diff --git a/app/forms/projects/life_cycle_step_definitions/finish_gate_name_form.rb b/app/forms/projects/life_cycle_step_definitions/finish_gate_name_form.rb
index 6dc4192ff39..f0f556a43f6 100644
--- a/app/forms/projects/life_cycle_step_definitions/finish_gate_name_form.rb
+++ b/app/forms/projects/life_cycle_step_definitions/finish_gate_name_form.rb
@@ -32,8 +32,8 @@ module Projects::LifeCycleStepDefinitions
class FinishGateNameForm < ApplicationForm
form do |f|
f.text_field(
- label: attribute_name(:end_gate_name),
- name: :end_gate_name,
+ label: attribute_name(:finish_gate_name),
+ name: :finish_gate_name,
input_width: :medium,
required: true
)
diff --git a/app/forms/projects/life_cycles/form.rb b/app/forms/projects/life_cycles/form.rb
index 50f291346db..52a764f544c 100644
--- a/app/forms/projects/life_cycles/form.rb
+++ b/app/forms/projects/life_cycles/form.rb
@@ -52,7 +52,7 @@ module Projects::LifeCycles
end
def multi_value_life_cycle_input(form)
- value = [model.start_date, model.end_date].compact.join(" - ")
+ value = [model.start_date, model.finish_date].compact.join(" - ")
input_attributes = { name: :date_range, value: }
if model.working_days_count
diff --git a/app/models/journal/project_phase_journal.rb b/app/models/journal/project_phase_journal.rb
index d59771e9d90..4bfc048cb38 100644
--- a/app/models/journal/project_phase_journal.rb
+++ b/app/models/journal/project_phase_journal.rb
@@ -34,6 +34,6 @@ class Journal::ProjectPhaseJournal < Journal::AssociatedJournal
belongs_to :phase, class_name: "Project::Phase"
def date_range
- start_date..end_date if start_date || end_date
+ start_date..finish_date if start_date || finish_date
end
end
diff --git a/app/models/project/phase.rb b/app/models/project/phase.rb
index 6f1d3ee08da..edfbe50b34a 100644
--- a/app/models/project/phase.rb
+++ b/app/models/project/phase.rb
@@ -38,9 +38,9 @@ class Project::Phase < ApplicationRecord
delegate :name,
:position,
:start_gate_name,
- :end_gate_name,
+ :finish_gate_name,
:start_gate?,
- :end_gate?,
+ :finish_gate?,
to: :definition
attr_readonly :definition_id, :type
@@ -57,16 +57,16 @@ class Project::Phase < ApplicationRecord
def working_days_count
return nil if not_set?
- Day.working.from_range(from: start_date, to: end_date).count
+ Day.working.from_range(from: start_date, to: finish_date).count
end
def date_range=(param)
- self.start_date, self.end_date = param.split(" - ")
- self.end_date ||= start_date # Allow single dates as range
+ self.start_date, self.finish_date = param.split(" - ")
+ self.finish_date ||= start_date # Allow single dates as range
end
def not_set?
- start_date.blank? || end_date.blank?
+ start_date.blank? || finish_date.blank?
end
def range_set?
@@ -74,10 +74,10 @@ class Project::Phase < ApplicationRecord
end
def range_incomplete?
- start_date.blank? ^ end_date.blank?
+ start_date.blank? ^ finish_date.blank?
end
def validate_date_range
- errors.add(:date_range, :start_date_must_be_before_end_date) if range_set? && (start_date > end_date)
+ errors.add(:date_range, :start_date_must_be_before_finish_date) if range_set? && (start_date > finish_date)
end
end
diff --git a/app/models/project/phase_definition.rb b/app/models/project/phase_definition.rb
index 73e5205f4eb..e49eced060b 100644
--- a/app/models/project/phase_definition.rb
+++ b/app/models/project/phase_definition.rb
@@ -41,7 +41,7 @@ class Project::PhaseDefinition < ApplicationRecord
validates :name, presence: true, uniqueness: true
validates :start_gate_name, presence: true, if: :start_gate?
- validates :end_gate_name, presence: true, if: :end_gate?
+ validates :finish_gate_name, presence: true, if: :finish_gate?
acts_as_list
default_scope { order(:position) }
diff --git a/app/models/queries/projects/filters/filter_on_project_phase.rb b/app/models/queries/projects/filters/filter_on_project_phase.rb
index fd3e4819d51..96160a5df55 100644
--- a/app/models/queries/projects/filters/filter_on_project_phase.rb
+++ b/app/models/queries/projects/filters/filter_on_project_phase.rb
@@ -98,26 +98,26 @@ module Queries::Projects::Filters::FilterOnProjectPhase
scope
end
- def phase_where_on(start_date, end_date = start_date)
+ def phase_where_on(start_date, finish_date = start_date)
project_phase_scope
.where(date_range_clause(Project::Phase.table_name, "start_date", nil, start_date))
- .where(date_range_clause(Project::Phase.table_name, "end_date", end_date, nil))
+ .where(date_range_clause(Project::Phase.table_name, "finish_date", finish_date, nil))
end
- def phase_where_between(start_date, end_date)
+ def phase_where_between(start_date, finish_date)
project_phase_scope
.where(date_range_clause(Project::Phase.table_name, "start_date", start_date, nil))
- .where(date_range_clause(Project::Phase.table_name, "end_date", nil, end_date))
+ .where(date_range_clause(Project::Phase.table_name, "finish_date", nil, finish_date))
end
def phase_overlaps_this_week
project_phase_scope
.where.not(start_date: nil)
- .where.not(end_date: nil)
+ .where.not(finish_date: nil)
.where(
<<~SQL.squish, beginning_of_week, end_of_week
daterange(#{Project::Phase.table_name}.start_date,
- #{Project::Phase.table_name}.end_date,
+ #{Project::Phase.table_name}.finish_date,
'[]')
&&
daterange(?, ?, '[]')
@@ -128,7 +128,7 @@ module Queries::Projects::Filters::FilterOnProjectPhase
def phase_none
project_phase_scope
.where(start_date: nil)
- .where(end_date: nil)
+ .where(finish_date: nil)
end
def parsed_start
diff --git a/app/models/queries/projects/filters/project_phase_gate_filter.rb b/app/models/queries/projects/filters/project_phase_gate_filter.rb
index 38d68d65581..46f69c5eb84 100644
--- a/app/models/queries/projects/filters/project_phase_gate_filter.rb
+++ b/app/models/queries/projects/filters/project_phase_gate_filter.rb
@@ -34,21 +34,21 @@ class Queries::Projects::Filters::ProjectPhaseGateFilter < Queries::Projects::Fi
class << self
def key
- /\Aproject_(?<gate>end|start)_gate_(?<id>\d+)\z/
+ /\Aproject_(?<gate>finish|start)_gate_(?<id>\d+)\z/
end
private
def accessor_matches?(definition, match)
- super && match[:gate].in?(%w[start end]) &&
+ super && match[:gate].in?(%w[start finish]) &&
((match[:gate] == "start" && definition.start_gate) ||
- (match[:gate] == "end" && definition.end_gate))
+ (match[:gate] == "finish" && definition.finish_gate))
end
def create_from_phase(phase, context)
filters = []
filters << create!(name: "project_start_gate_#{phase.id}", context:) if phase.start_gate
- filters << create!(name: "project_end_gate_#{phase.id}", context:) if phase.end_gate
+ filters << create!(name: "project_finish_gate_#{phase.id}", context:) if phase.finish_gate
filters
end
end
@@ -63,7 +63,7 @@ class Queries::Projects::Filters::ProjectPhaseGateFilter < Queries::Projects::Fi
gate_name = if project_phase_gate == "start"
project_phase_definition.start_gate_name
else
- project_phase_definition.end_gate_name
+ project_phase_definition.finish_gate_name
end
I18n.t("project.filters.project_phase_gate", gate: gate_name)
@@ -94,12 +94,12 @@ class Queries::Projects::Filters::ProjectPhaseGateFilter < Queries::Projects::Fi
.where(column_name => nil)
end
- def gate_where(start_date, end_date = start_date)
+ def gate_where(start_date, finish_date = start_date)
project_phase_scope
.where(date_range_clause(Project::Phase.table_name,
column_name,
start_date,
- end_date))
+ finish_date))
end
def project_phase_scope_limit(scope)
diff --git a/app/models/queries/projects/orders/project_phase_order.rb b/app/models/queries/projects/orders/project_phase_order.rb
index d445f1e5138..288a61171a9 100644
--- a/app/models/queries/projects/orders/project_phase_order.rb
+++ b/app/models/queries/projects/orders/project_phase_order.rb
@@ -78,7 +78,7 @@ class Queries::Projects::Orders::ProjectPhaseOrder < Queries::Orders::Base
def order(scope)
with_raise_on_invalid do
scope.where(order_condition)
- .order(*order_by_start_and_end_date)
+ .order(*order_by_start_and_finish_date)
end
end
@@ -99,13 +99,13 @@ class Queries::Projects::Orders::ProjectPhaseOrder < Queries::Orders::Base
.or(steps_table[:def_id].eq(nil))
end
- def order_by_start_and_end_date
+ def order_by_start_and_finish_date
steps_table = Arel::Table.new(subquery_table_name.to_s)
- # Even though a gate does not define an end_date, this code still works.
+ # Even though a gate does not define an finish_date, this code still works.
[
steps_table[:start_date].send(direction),
- steps_table[:end_date].send(direction)
+ steps_table[:finish_date].send(direction)
]
end
end
diff --git a/app/services/journals/create_service/project_phase.rb b/app/services/journals/create_service/project_phase.rb
index afede868e41..718d6752651 100644
--- a/app/services/journals/create_service/project_phase.rb
+++ b/app/services/journals/create_service/project_phase.rb
@@ -48,14 +48,14 @@ class Journals::CreateService
journal_id,
phase_id,
start_date,
- end_date,
+ finish_date,
active
)
SELECT
#{id_from_inserted_journal_sql},
project_phases.id,
project_phases.start_date,
- project_phases.end_date,
+ project_phases.finish_date,
project_phases.active
FROM project_phases
WHERE
@@ -82,7 +82,7 @@ class Journals::CreateService
phases.id = project_phase_journals.phase_id
WHERE
phases.start_date IS DISTINCT FROM project_phase_journals.start_date
- OR phases.end_date IS DISTINCT FROM project_phase_journals.end_date
+ OR phases.finish_date IS DISTINCT FROM project_phase_journals.finish_date
OR phases.active IS DISTINCT FROM project_phase_journals.active
SQL
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 09ec8741a91..fdca9e9bdf5 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1043,8 +1043,8 @@ en:
color: "Color"
start_gate: "Start phase gate"
start_gate_name: "Start phase gate name"
- end_gate: "Finish phase gate"
- end_gate_name: "Finish phase gate name"
+ finish_gate: "Finish phase gate"
+ finish_gate_name: "Finish phase gate name"
query:
sums: "Sums"
columns: "Columns"
@@ -1349,7 +1349,7 @@ en:
project/phase:
attributes:
date_range:
- start_date_must_be_before_end_date: "start date must be before the end date."
+ start_date_must_be_before_finish_date: "start date must be before the finish date."
non_continuous_dates: "can't be earlier than the previous phase's end date."
incomplete: "is incomplete."
query:
@@ -1655,7 +1655,7 @@ en:
changed_date: "changed from %{from} to %{to}"
removed_date: "date deleted %{date}"
phase_and_one_gate: "%{phase_message}. %{gate_message}"
- phase_and_both_gates: "%{phase_message}. %{start_gate_message}, and %{end_gate_message}"
+ phase_and_both_gates: "%{phase_message}. %{start_gate_message}, and %{finish_gate_message}"
# common attributes of all models
attributes:
@@ -3982,8 +3982,8 @@ en:
no_gate: "No gate"
start_gate: "Start gate"
start_gate_caption: "Add a gate with the start date of the phase"
- end_gate: "Finish gate"
- end_gate_caption: "Add a gate with the end date of the phase"
+ finish_gate: "Finish gate"
+ finish_gate_caption: "Add a gate with the end date of the phase"
projects:
missing_dependencies: "Project module %{module} was checked which depends on %{dependencies}. You need to check these dependencies as well."
section_new_projects: "Settings for new projects"
diff --git a/db/migrate/20250324161229_merge_lifecycle_steps.rb b/db/migrate/20250324161229_merge_lifecycle_steps.rb
index ac3766fe717..9d2e870911c 100644
--- a/db/migrate/20250324161229_merge_lifecycle_steps.rb
+++ b/db/migrate/20250324161229_merge_lifecycle_steps.rb
@@ -97,20 +97,20 @@ class MergeLifecycleSteps < ActiveRecord::Migration[8.0]
change_table(:project_life_cycle_step_definitions, bulk: true) do |t|
t.column :start_gate, :boolean, default: false, null: false
t.column :start_gate_name, :string
- # TODO: Consider renaming all 'end_date' columns to 'finish_date' to be in line with how the
- # dates are to be named for work packages
- t.column :end_gate, :boolean, default: false, null: false
- t.column :end_gate_name, :string
+ t.column :finish_gate, :boolean, default: false, null: false
+ t.column :finish_gate_name, :string
t.remove :type, type: :string
end
change_table(:project_life_cycle_steps) do |t|
t.remove :type, type: :string
+ t.rename :end_date, :finish_date
end
change_table(:project_life_cycle_step_journals) do |t|
t.rename :life_cycle_step_id, :phase_id
+ t.rename :end_date, :finish_date
end
change_table(:work_packages) do |t|
diff --git a/lib/open_project/journal_formatter/project_phase_dates.rb b/lib/open_project/journal_formatter/project_phase_dates.rb
index c4cf2bca0a1..bfcc4dcf88b 100644
--- a/lib/open_project/journal_formatter/project_phase_dates.rb
+++ b/lib/open_project/journal_formatter/project_phase_dates.rb
@@ -38,11 +38,11 @@ class OpenProject::JournalFormatter::ProjectPhaseDates < JournalFormatter::Base
return unless phase_message
start_gate_message = format_start_gate_message(step:, values:, html:)
- end_gate_message = format_end_gate_message(step:, values:, html:)
+ finish_gate_message = format_finish_gate_message(step:, values:, html:)
- if start_gate_message && end_gate_message
- I18n.t("activity.project_phase.phase_and_both_gates", phase_message:, start_gate_message:, end_gate_message:)
- elsif (gate_message = start_gate_message || end_gate_message)
+ if start_gate_message && finish_gate_message
+ I18n.t("activity.project_phase.phase_and_both_gates", phase_message:, start_gate_message:, finish_gate_message:)
+ elsif (gate_message = start_gate_message || finish_gate_message)
I18n.t("activity.project_phase.phase_and_one_gate", phase_message:, gate_message:)
else
phase_message
@@ -70,13 +70,13 @@ class OpenProject::JournalFormatter::ProjectPhaseDates < JournalFormatter::Base
format_message(name:, from:, to:, html:)
end
- def format_end_gate_message(step:, values:, html:)
- return unless step.definition.end_gate
+ def format_finish_gate_message(step:, values:, html:)
+ return unless step.definition.finish_gate
values = values.map { it&.end }
return if values[0] == values[1]
- name = step.definition.end_gate_name
+ name = step.definition.finish_gate_name
from, to = values.map { format_date(it) }
format_message(name:, from:, to:, html:)
diff --git a/lookbook/previews/open_project/projects/life_cycle_component_preview.rb b/lookbook/previews/open_project/projects/life_cycle_component_preview.rb
index 4d04f3fcf86..fa5daee61ab 100644
--- a/lookbook/previews/open_project/projects/life_cycle_component_preview.rb
+++ b/lookbook/previews/open_project/projects/life_cycle_component_preview.rb
@@ -33,9 +33,9 @@ module OpenProject
# @logical_path OpenProject/Projects
class LifeCycleComponentPreview < Lookbook::Preview
# @param start_gate [boolean]
- # @param end_gate [boolean]
- def phase(start_gate: false, end_gate: false)
- model = Project::PhaseDefinition.new(id: 1, name: "The first phase", start_gate:, end_gate:)
+ # @param finish_gate [boolean]
+ def phase(start_gate: false, finish_gate: false)
+ model = Project::PhaseDefinition.new(id: 1, name: "The first phase", start_gate:, finish_gate:)
render_with_template(locals: { model: })
end
end
diff --git a/lookbook/previews/open_project/projects/phase_component_preview.rb b/lookbook/previews/open_project/projects/phase_component_preview.rb
index f22fc0c5603..0a918b32d46 100644
--- a/lookbook/previews/open_project/projects/phase_component_preview.rb
+++ b/lookbook/previews/open_project/projects/phase_component_preview.rb
@@ -33,7 +33,7 @@ module OpenProject::Projects
class PhaseComponentPreview < Lookbook::Preview
def phase_with_both_gates
phase = Project::Phase.new(id: 1,
- definition: definition(start_gate: true, end_gate: true),
+ definition: definition(start_gate: true, finish_gate: true),
start_date: Date.current - 2.days,
end_date: Date.current + 2.days)
@@ -42,7 +42,7 @@ module OpenProject::Projects
def phase_with_both_gates_dates_not_set
phase = Project::Phase.new(id: 1,
- definition: definition(start_gate: true, end_gate: true))
+ definition: definition(start_gate: true, finish_gate: true))
render_with_template(locals: { phase: })
end
@@ -56,9 +56,9 @@ module OpenProject::Projects
render_with_template(locals: { phase: })
end
- def phase_with_end_gate
+ def phase_with_finish_gate
phase = Project::Phase.new(id: 1,
- definition: definition(end_gate: true),
+ definition: definition(finish_gate: true),
start_date: Date.current - 2.days,
end_date: Date.current + 2.days)
@@ -76,13 +76,13 @@ module OpenProject::Projects
private
- def definition(start_gate: false, end_gate: false)
+ def definition(start_gate: false, finish_gate: false)
Project::PhaseDefinition.new(id: 1,
name: "The first gate",
start_gate: start_gate,
start_gate_name: start_gate ? "Before the phase" : nil,
- end_gate: end_gate,
- end_gate_name: end_gate ? "After the phase" : nil)
+ finish_gate: finish_gate,
+ finish_gate_name: finish_gate ? "After the phase" : nil)
end
end
end
diff --git a/spec/contracts/project_life_cycle_steps/base_contract_spec.rb b/spec/contracts/project_life_cycle_steps/base_contract_spec.rb
index d0aec73251f..36f32dfba27 100644
--- a/spec/contracts/project_life_cycle_steps/base_contract_spec.rb
+++ b/spec/contracts/project_life_cycle_steps/base_contract_spec.rb
@@ -53,9 +53,9 @@ RSpec.describe ProjectLifeCycleSteps::BaseContract do
describe "validations" do
describe "#consecutive_phases_have_increasing_dates" do
- let(:phase1) { build_stubbed(:project_phase, start_date: Date.new(2024, 1, 1), end_date: Date.new(2024, 1, 1)) }
- let(:phase2) { build_stubbed(:project_phase, start_date: Date.new(2024, 2, 1), end_date: Date.new(2024, 2, 28)) }
- let(:phase3) { build_stubbed(:project_phase, start_date: Date.new(2024, 3, 1), end_date: Date.new(2024, 3, 15)) }
+ let(:phase1) { build_stubbed(:project_phase, start_date: Date.new(2024, 1, 1), finish_date: Date.new(2024, 1, 1)) }
+ let(:phase2) { build_stubbed(:project_phase, start_date: Date.new(2024, 2, 1), finish_date: Date.new(2024, 2, 28)) }
+ let(:phase3) { build_stubbed(:project_phase, start_date: Date.new(2024, 3, 1), finish_date: Date.new(2024, 3, 15)) }
let(:phases) { [phase1, phase2, phase3] }
context "when no phases are present" do
@@ -91,7 +91,7 @@ RSpec.describe ProjectLifeCycleSteps::BaseContract do
end
context "when phases with identical dates" do
- let(:phase2) { build_stubbed(:project_phase, start_date: Date.new(2024, 1, 1), end_date: Date.new(2024, 1, 1)) }
+ let(:phase2) { build_stubbed(:project_phase, start_date: Date.new(2024, 1, 1), finish_date: Date.new(2024, 1, 1)) }
it_behaves_like "contract is invalid",
"available_phases.date_range": :non_continuous_dates
@@ -99,13 +99,13 @@ RSpec.describe ProjectLifeCycleSteps::BaseContract do
context "when phases have touching start and end dates" do
context "when 2 Phases are touching" do
- let(:phase2) { build_stubbed(:project_phase, start_date: Date.new(2024, 1, 1), end_date: Date.new(2024, 1, 1)) }
+ let(:phase2) { build_stubbed(:project_phase, start_date: Date.new(2024, 1, 1), finish_date: Date.new(2024, 1, 1)) }
it_behaves_like "contract is invalid",
"available_phases.date_range": :non_continuous_dates
context "when having an empty step in between" do
- let(:step_missing_dates) { build_stubbed(:project_phase, start_date: nil, end_date: nil) }
+ let(:step_missing_dates) { build_stubbed(:project_phase, start_date: nil, finish_date: nil) }
let(:phases) { [phase1, step_missing_dates, phase2] }
it_behaves_like "contract is invalid",
@@ -114,8 +114,8 @@ RSpec.describe ProjectLifeCycleSteps::BaseContract do
end
context "when 3 Phases are touching" do
- let(:phase2) { build_stubbed(:project_phase, start_date: Date.new(2024, 1, 1), end_date: Date.new(2024, 1, 1)) }
- let(:phase3) { build_stubbed(:project_phase, start_date: Date.new(2024, 1, 1), end_date: Date.new(2024, 1, 2)) }
+ let(:phase2) { build_stubbed(:project_phase, start_date: Date.new(2024, 1, 1), finish_date: Date.new(2024, 1, 1)) }
+ let(:phase3) { build_stubbed(:project_phase, start_date: Date.new(2024, 1, 1), finish_date: Date.new(2024, 1, 2)) }
it_behaves_like "contract is invalid",
"available_phases.date_range": :non_continuous_dates
@@ -127,7 +127,7 @@ RSpec.describe ProjectLifeCycleSteps::BaseContract do
end
context "when having an empty step in between" do
- let(:step_missing_dates) { build_stubbed(:project_phase, start_date: nil, end_date: nil) }
+ let(:step_missing_dates) { build_stubbed(:project_phase, start_date: nil, finish_date: nil) }
let(:phases) { [phase1, phase2, step_missing_dates, phase3] }
it_behaves_like "contract is invalid",
@@ -144,7 +144,7 @@ RSpec.describe ProjectLifeCycleSteps::BaseContract do
end
context "when a step has missing start dates" do
- let(:step_missing_dates) { build_stubbed(:project_phase, start_date: nil, end_date: nil) }
+ let(:step_missing_dates) { build_stubbed(:project_phase, start_date: nil, finish_date: nil) }
context "and the other phases have increasing dates" do
let(:phases) { [phase1, step_missing_dates, phase2] }
diff --git a/spec/factories/project_phase_definition_factory.rb b/spec/factories/project_phase_definition_factory.rb
index 2ee8147b7a0..5538277f648 100644
--- a/spec/factories/project_phase_definition_factory.rb
+++ b/spec/factories/project_phase_definition_factory.rb
@@ -37,16 +37,16 @@ FactoryBot.define do
sequence(:start_gate_name) { |n| "Phase definition Start Gate #{n}" }
end
- trait :with_end_gate do
- end_gate { true }
- sequence(:end_gate_name) { |n| "Phase definition End Gate #{n}" }
+ trait :with_finish_gate do
+ finish_gate { true }
+ sequence(:finish_gate_name) { |n| "Phase definition Finish Gate #{n}" }
end
trait :with_gates do
start_gate { true }
- end_gate { true }
+ finish_gate { true }
sequence(:start_gate_name) { |n| "Phase definition Start Gate #{n}" }
- sequence(:end_gate_name) { |n| "Phase definition End Gate #{n}" }
+ sequence(:finish_gate_name) { |n| "Phase definition Finish Gate #{n}" }
end
end
end
diff --git a/spec/factories/project_phase_factory.rb b/spec/factories/project_phase_factory.rb
index e8475251bea..bf5e600d07d 100644
--- a/spec/factories/project_phase_factory.rb
+++ b/spec/factories/project_phase_factory.rb
@@ -35,14 +35,14 @@ FactoryBot.define do
active { true }
start_date { Date.current - 2.days }
- end_date { Date.current + 2.days }
+ finish_date { Date.current + 2.days }
trait :skip_validate do
to_create { |instance| instance.save(validate: false) }
end
trait :with_gated_definition do
- definition { association(:project_phase_definition, :with_start_gate, :with_end_gate) }
+ definition { association(:project_phase_definition, :with_start_gate, :with_finish_gate) }
end
end
end
diff --git a/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb b/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb
index d3b13c9a5c4..98c58e4ca51 100644
--- a/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb
+++ b/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb
@@ -49,7 +49,7 @@ RSpec.describe "Edit project stages and gates on project overview page", :js, wi
describe "with the dialog open" do
context "when all LifeCycleSteps are blank" do
before do
- Project::Phase.update_all(start_date: nil, end_date: nil)
+ Project::Phase.update_all(start_date: nil, finish_date: nil)
end
it "shows all the Project::Phases without a value" do
@@ -90,7 +90,7 @@ RSpec.describe "Edit project stages and gates on project overview page", :js, wi
retry_block do
# Retrying due to a race condition between filling the input vs submitting the form preview.
- original_dates = [life_cycle_initiating.start_date, life_cycle_initiating.end_date]
+ original_dates = [life_cycle_initiating.start_date, life_cycle_initiating.finish_date]
dialog.set_date_for(life_cycle_initiating, values: original_dates)
page.driver.clear_network_traffic
@@ -114,7 +114,7 @@ RSpec.describe "Edit project stages and gates on project overview page", :js, wi
ready_for_planning_dates = [
life_cycle_ready_for_planning.start_date,
- life_cycle_ready_for_planning.end_date
+ life_cycle_ready_for_planning.finish_date
].map { I18n.l(it) }.join("\n-\n")
overview_page.within_life_cycle_container(life_cycle_ready_for_planning) do
@@ -134,13 +134,13 @@ RSpec.describe "Edit project stages and gates on project overview page", :js, wi
activity_page.within_journal(number: 1) do
activity_page.expect_activity("Initiating changed from " \
"#{I18n.l life_cycle_initiating_was.start_date} - " \
- "#{I18n.l life_cycle_initiating_was.end_date} to " \
+ "#{I18n.l life_cycle_initiating_was.finish_date} to " \
"#{I18n.l life_cycle_initiating.start_date} - " \
- "#{I18n.l life_cycle_initiating.end_date}")
+ "#{I18n.l life_cycle_initiating.finish_date}")
activity_page.expect_activity("Ready for Planning date deleted " \
"#{I18n.l life_cycle_ready_for_planning_was.start_date} - " \
- "#{I18n.l life_cycle_ready_for_planning_was.end_date}")
+ "#{I18n.l life_cycle_ready_for_planning_was.finish_date}")
end
end
@@ -191,12 +191,12 @@ RSpec.describe "Edit project stages and gates on project overview page", :js, wi
activity_page.within_journal(number: 1) do
expected_date_from = [
I18n.l(life_cycle_ready_for_planning_was.start_date),
- I18n.l(life_cycle_ready_for_planning_was.end_date)
+ I18n.l(life_cycle_ready_for_planning_was.finish_date)
].join(" - ")
expected_date_to = [
I18n.l(life_cycle_ready_for_planning.start_date),
- I18n.l(life_cycle_ready_for_planning.end_date)
+ I18n.l(life_cycle_ready_for_planning.finish_date)
].join(" - ")
activity_page.expect_activity("Ready for Planning changed from " \
"#{expected_date_from} to " \
diff --git a/spec/features/projects/life_cycle/overview_page/shared_context.rb b/spec/features/projects/life_cycle/overview_page/shared_context.rb
index 8e152577a94..cfda439b532 100644
--- a/spec/features/projects/life_cycle/overview_page/shared_context.rb
+++ b/spec/features/projects/life_cycle/overview_page/shared_context.rb
@@ -59,49 +59,49 @@ RSpec.shared_context "with seeded projects and stages and gates" do
create :project_phase,
definition: life_cycle_initiating_definition,
start_date:,
- end_date: start_date + 1.day,
+ finish_date: start_date + 1.day,
project:
end
let(:life_cycle_ready_for_planning) do
create :project_phase,
definition: life_cycle_ready_for_planning_definition,
start_date: start_date + 2.days,
- end_date: start_date + 2.days,
+ finish_date: start_date + 2.days,
project:
end
let(:life_cycle_planning) do
create :project_phase,
definition: life_cycle_planning_definition,
start_date: start_date + 4.days,
- end_date: start_date + 7.days,
+ finish_date: start_date + 7.days,
project:
end
let(:life_cycle_ready_for_executing) do
create :project_phase,
definition: life_cycle_ready_for_executing_definition,
start_date: start_date + 8.days,
- end_date: start_date + 8.days,
+ finish_date: start_date + 8.days,
project:
end
let(:life_cycle_executing) do
create :project_phase,
definition: life_cycle_executing_definition,
start_date: start_date + 9.days,
- end_date: start_date + 10.days,
+ finish_date: start_date + 10.days,
project:
end
let(:life_cycle_ready_for_closing) do
create :project_phase,
definition: life_cycle_ready_for_closing_definition,
start_date: start_date + 11.days,
- end_date: start_date + 11.days,
+ finish_date: start_date + 11.days,
project:
end
let(:life_cycle_closing) do
create :project_phase,
definition: life_cycle_closing_definition,
start_date: start_date + 14.days,
- end_date: start_date + 18.days,
+ finish_date: start_date + 18.days,
project:
end
diff --git a/spec/features/projects/life_cycle/overview_page/sidebar_spec.rb b/spec/features/projects/life_cycle/overview_page/sidebar_spec.rb
index eef93295bf7..26dfc4679f1 100644
--- a/spec/features/projects/life_cycle/overview_page/sidebar_spec.rb
+++ b/spec/features/projects/life_cycle/overview_page/sidebar_spec.rb
@@ -119,8 +119,9 @@ RSpec.describe "Show project life cycles on project overview page", :js, with_fl
overview_page.within_life_cycle_container(life_cycle) do
expected_date = [
life_cycle.start_date.strftime("%m/%d/%Y"),
- life_cycle.end_date.strftime("%m/%d/%Y")
+ life_cycle.finish_date.strftime("%m/%d/%Y")
].join("\n-\n")
+
expect(page).to have_text expected_date
end
end
@@ -130,7 +131,7 @@ RSpec.describe "Show project life cycles on project overview page", :js, with_fl
describe "with no values" do
before do
- Project::Phase.update_all(start_date: nil, end_date: nil)
+ Project::Phase.update_all(start_date: nil, finish_date: nil)
end
it "shows the correct value for the project custom field if given" do
diff --git a/spec/features/projects/lists/columns_spec.rb b/spec/features/projects/lists/columns_spec.rb
index ccf4071325b..c8de11b7712 100644
--- a/spec/features/projects/lists/columns_spec.rb
+++ b/spec/features/projects/lists/columns_spec.rb
@@ -256,13 +256,13 @@ RSpec.describe "Projects lists columns", :js, with_settings: { login_required?:
:with_gated_definition,
project: development_project,
start_date: Date.new(2024, 12, 1),
- end_date: Date.new(2024, 12, 13))
+ finish_date: Date.new(2024, 12, 13))
end
shared_let(:project_phase) do
create(:project_phase,
project:,
start_date: Date.new(2024, 12, 1),
- end_date: Date.new(2024, 12, 13))
+ finish_date: Date.new(2024, 12, 13))
end
shared_let(:inactive_project_phase_with_gates) do
create(:project_phase,
@@ -280,7 +280,7 @@ RSpec.describe "Projects lists columns", :js, with_settings: { login_required?:
element_selector = "#columns-select_autocompleter ng-select.op-draggable-autocomplete--input"
results_selector = "#columns-select_autocompleter ng-dropdown-panel .ng-dropdown-panel-items"
projects_page.expect_no_config_columns(project_phase_with_gates.start_gate_name,
- project_phase_with_gates.end_gate_name,
+ project_phase_with_gates.finish_gate_name,
project_phase.name,
inactive_project_phase_with_gates.name,
inactive_project_phase.name,
@@ -299,7 +299,7 @@ RSpec.describe "Projects lists columns", :js, with_settings: { login_required?:
specify "configuring project phase column display" do
# project phase columns do not show up by default
projects_page.expect_columns("Name")
- projects_page.expect_no_columns(project_phase_with_gates.end_gate_name,
+ projects_page.expect_no_columns(project_phase_with_gates.finish_gate_name,
project_phase_with_gates.start_gate_name,
project_phase_with_gates.name,
project_phase.name,
diff --git a/spec/features/projects/lists/filters_spec.rb b/spec/features/projects/lists/filters_spec.rb
index 4093048a669..2a430ca2172 100644
--- a/spec/features/projects/lists/filters_spec.rb
+++ b/spec/features/projects/lists/filters_spec.rb
@@ -54,13 +54,13 @@ RSpec.describe "Projects list filters", :js, with_settings: { login_required?: f
})
end
shared_let(:stage) do
- create(:project_phase, project:, start_date: Time.zone.today - 5.days, end_date: Time.zone.today + 10.days)
+ create(:project_phase, project:, start_date: Time.zone.today - 5.days, finish_date: Time.zone.today + 10.days)
end
shared_let(:gate) do
create(:project_phase,
:with_gated_definition,
project: public_project,
- end_date: Time.zone.today)
+ finish_date: Time.zone.today)
end
let(:news) { create(:news, project:) }
@@ -854,54 +854,54 @@ RSpec.describe "Projects list filters", :js, with_settings: { login_required?: f
it "allows filtering the projects by the project phase gate" do
load_and_open_filters manager
- projects_page.set_filter("project_end_gate_#{gate.definition_id}",
- "Project phase gate: #{gate.end_gate_name}",
+ projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
+ "Project phase gate: #{gate.finish_gate_name}",
"on",
[Time.zone.today])
projects_page.expect_projects_not_listed(development_project, project)
projects_page.expect_projects_in_order(public_project)
- projects_page.remove_filter("project_end_gate_#{gate.definition_id}")
+ projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_end_gate_#{gate.definition_id}",
- "Project phase gate: #{gate.end_gate_name}",
+ projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
+ "Project phase gate: #{gate.finish_gate_name}",
"today")
projects_page.expect_projects_not_listed(development_project, project)
projects_page.expect_projects_in_order(public_project)
- projects_page.remove_filter("project_end_gate_#{gate.definition_id}")
+ projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_end_gate_#{gate.definition_id}",
- "Project phase gate: #{gate.end_gate_name}",
+ projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
+ "Project phase gate: #{gate.finish_gate_name}",
"between",
[Time.zone.today - 5.days, Time.zone.today + 10.days])
projects_page.expect_projects_not_listed(development_project, project)
projects_page.expect_projects_in_order(public_project)
- projects_page.remove_filter("project_end_gate_#{gate.definition_id}")
+ projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_end_gate_#{gate.definition_id}",
- "Project phase gate: #{gate.end_gate_name}",
+ projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
+ "Project phase gate: #{gate.finish_gate_name}",
"this week")
projects_page.expect_projects_not_listed(development_project, project)
projects_page.expect_projects_in_order(public_project)
- projects_page.remove_filter("project_end_gate_#{gate.definition_id}")
+ projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_end_gate_#{gate.definition_id}",
- "Project phase gate: #{gate.end_gate_name}",
+ projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
+ "Project phase gate: #{gate.finish_gate_name}",
"is empty")
projects_page.expect_projects_not_listed(public_project, development_project, project)
diff --git a/spec/features/projects/lists/order_spec.rb b/spec/features/projects/lists/order_spec.rb
index c4880d49512..3e8a9ec86c3 100644
--- a/spec/features/projects/lists/order_spec.rb
+++ b/spec/features/projects/lists/order_spec.rb
@@ -280,28 +280,28 @@ RSpec.describe "Projects lists ordering", :js, with_settings: { login_required?:
project:,
definition: stage_def,
start_date: Date.new(2025, 1, 1),
- end_date: Date.new(2025, 1, 13))
+ finish_date: Date.new(2025, 1, 13))
end
let!(:public_stage) do
create(:project_phase,
project: public_project,
definition: stage_def,
start_date: Date.new(2025, 2, 12),
- end_date: Date.new(2025, 2, 20))
+ finish_date: Date.new(2025, 2, 20))
end
let!(:child_stage) do
create(:project_phase,
project: child_project_m,
definition: stage_def,
start_date: public_stage.start_date,
- end_date: public_stage.end_date + 1.day)
+ finish_date: public_stage.finish_date + 1.day)
end
let!(:last_stage) do
create(:project_phase,
project: development_project,
definition: stage_def,
start_date: public_stage.start_date,
- end_date: public_stage.end_date + 2.days)
+ finish_date: public_stage.finish_date + 2.days)
end
let(:gate_def) { create(:project_phase_definition, :with_start_gate) }
diff --git a/spec/lib/acts/journalized/differ/association_spec.rb b/spec/lib/acts/journalized/differ/association_spec.rb
index ff103530df9..f1f8e867809 100644
--- a/spec/lib/acts/journalized/differ/association_spec.rb
+++ b/spec/lib/acts/journalized/differ/association_spec.rb
@@ -135,7 +135,7 @@ RSpec.describe Acts::Journalized::Differ::Association do
build_stubbed(:project_phase_journal, phase_id: 3, active: true),
build_stubbed(:project_phase_journal, phase_id: 4, active: true,
start_date: Date.new(2024, 1, 16),
- end_date: Date.new(2024, 1, 17))
+ finish_date: Date.new(2024, 1, 17))
])
end
@@ -145,10 +145,10 @@ RSpec.describe Acts::Journalized::Differ::Association do
build_stubbed(:project_phase_journal, phase_id: 2, active: true),
build_stubbed(:project_phase_journal, phase_id: 3, active: false,
start_date: Date.new(2024, 1, 17),
- end_date: Date.new(2024, 1, 18)),
+ finish_date: Date.new(2024, 1, 18)),
build_stubbed(:project_phase_journal, phase_id: 4, active: true,
start_date: Date.new(2024, 1, 17),
- end_date: Date.new(2024, 1, 18))
+ finish_date: Date.new(2024, 1, 18))
])
end
@@ -161,7 +161,7 @@ RSpec.describe Acts::Journalized::Differ::Association do
subject(:result) do
instance.multiple_attributes_changes(
- %i[active start_date end_date],
+ %i[active start_date finish_date],
key_prefix: "project_life_cycle_steps"
)
end
@@ -178,10 +178,10 @@ RSpec.describe Acts::Journalized::Differ::Association do
"project_life_cycle_steps_3_active" => ["true", "false"],
"project_life_cycle_steps_3_start_date" => ["", "2024-01-17"],
- "project_life_cycle_steps_3_end_date" => ["", "2024-01-18"],
+ "project_life_cycle_steps_3_finish_date" => ["", "2024-01-18"],
"project_life_cycle_steps_4_start_date" => ["2024-01-16", "2024-01-17"],
- "project_life_cycle_steps_4_end_date" => ["2024-01-17", "2024-01-18"]
+ "project_life_cycle_steps_4_finish_date" => ["2024-01-17", "2024-01-18"]
)
end
end
@@ -199,10 +199,10 @@ RSpec.describe Acts::Journalized::Differ::Association do
"project_life_cycle_steps_3_active" => [[true], [false]],
"project_life_cycle_steps_3_start_date" => [nil, [Date.new(2024, 1, 17)]],
- "project_life_cycle_steps_3_end_date" => [nil, [Date.new(2024, 1, 18)]],
+ "project_life_cycle_steps_3_finish_date" => [nil, [Date.new(2024, 1, 18)]],
"project_life_cycle_steps_4_start_date" => [[Date.new(2024, 1, 16)], [Date.new(2024, 1, 17)]],
- "project_life_cycle_steps_4_end_date" => [[Date.new(2024, 1, 17)], [Date.new(2024, 1, 18)]]
+ "project_life_cycle_steps_4_finish_date" => [[Date.new(2024, 1, 17)], [Date.new(2024, 1, 18)]]
)
end
end
@@ -219,10 +219,10 @@ RSpec.describe Acts::Journalized::Differ::Association do
"project_life_cycle_steps_3_active" => [true, false],
"project_life_cycle_steps_3_start_date" => [nil, Date.new(2024, 1, 17)],
- "project_life_cycle_steps_3_end_date" => [nil, Date.new(2024, 1, 18)],
+ "project_life_cycle_steps_3_finish_date" => [nil, Date.new(2024, 1, 18)],
"project_life_cycle_steps_4_start_date" => [Date.new(2024, 1, 16), Date.new(2024, 1, 17)],
- "project_life_cycle_steps_4_end_date" => [Date.new(2024, 1, 17), Date.new(2024, 1, 18)]
+ "project_life_cycle_steps_4_finish_date" => [Date.new(2024, 1, 17), Date.new(2024, 1, 18)]
)
end
end
diff --git a/spec/lib/open_project/journal_formatter/project_phase_active_spec.rb b/spec/lib/open_project/journal_formatter/project_phase_active_spec.rb
index b0ad29d24de..b13d99ecfe8 100644
--- a/spec/lib/open_project/journal_formatter/project_phase_active_spec.rb
+++ b/spec/lib/open_project/journal_formatter/project_phase_active_spec.rb
@@ -116,7 +116,7 @@ RSpec.describe OpenProject::JournalFormatter::ProjectPhaseActive do
let(:definition) do
build_stubbed(
:project_phase_definition,
- :with_end_gate,
+ :with_finish_gate,
name: "The Phase"
)
end
@@ -129,7 +129,7 @@ RSpec.describe OpenProject::JournalFormatter::ProjectPhaseActive do
build_stubbed(
:project_phase_definition,
:with_start_gate,
- :with_end_gate,
+ :with_finish_gate,
name: "The Phase"
)
end
diff --git a/spec/lib/open_project/journal_formatter/project_phase_dates_spec.rb b/spec/lib/open_project/journal_formatter/project_phase_dates_spec.rb
index ec9d93af111..65d40e18447 100644
--- a/spec/lib/open_project/journal_formatter/project_phase_dates_spec.rb
+++ b/spec/lib/open_project/journal_formatter/project_phase_dates_spec.rb
@@ -224,8 +224,8 @@ RSpec.describe OpenProject::JournalFormatter::ProjectPhaseDates do
build_stubbed(
:project_phase_definition,
name: "The Phase",
- end_gate: true,
- end_gate_name: "The End Gate"
+ finish_gate: true,
+ finish_gate_name: "The End Gate"
)
end
@@ -311,8 +311,8 @@ RSpec.describe OpenProject::JournalFormatter::ProjectPhaseDates do
name: "The Phase",
start_gate: true,
start_gate_name: "The Start Gate",
- end_gate: true,
- end_gate_name: "The End Gate"
+ finish_gate: true,
+ finish_gate_name: "The End Gate"
)
end
diff --git a/spec/models/project/phase_spec.rb b/spec/models/project/phase_spec.rb
index 000d01d0b47..d2f0f90df36 100644
--- a/spec/models/project/phase_spec.rb
+++ b/spec/models/project/phase_spec.rb
@@ -61,47 +61,47 @@ RSpec.describe Project::Phase do
end
describe "#not_set?" do
- it "returns true if start_date or end_date is blank" do
+ it "returns true if start_date or finish_date is blank" do
expect(subject.not_set?).to be(true)
end
- it "returns false if both start_date and end_date are present" do
+ it "returns false if both start_date and finish_date are present" do
subject.start_date = Time.zone.today
- subject.end_date = Date.tomorrow
+ subject.finish_date = Date.tomorrow
expect(subject.not_set?).to be(false)
end
end
describe "#date_range=" do
- it "splits a valid date range string into start_date and end_date" do
+ it "splits a valid date range string into start_date and finish_date" do
subject.date_range = "2024-11-26 - 2024-11-27"
expect(subject.start_date).to eq(Date.parse("2024-11-26"))
- expect(subject.end_date).to eq(Date.parse("2024-11-27"))
+ expect(subject.finish_date).to eq(Date.parse("2024-11-27"))
end
- it "sets end_date to start_date if a single date is provided" do
+ it "sets finish_date to start_date if a single date is provided" do
subject.date_range = "2024-11-26"
expect(subject.start_date).to eq(Date.parse("2024-11-26"))
- expect(subject.end_date).to eq(Date.parse("2024-11-26"))
+ expect(subject.finish_date).to eq(Date.parse("2024-11-26"))
end
end
describe "#validate_date_range" do
it "is valid when both dates are blank" do
- stage = build(:project_phase, start_date: nil, end_date: nil)
+ stage = build(:project_phase, start_date: nil, finish_date: nil)
expect(stage).to be_valid
end
- it "adds error if start_date is after end_date" do
+ it "adds error if start_date is after finish_date" do
subject.start_date = Date.tomorrow
- subject.end_date = Time.zone.today
+ subject.finish_date = Time.zone.today
expect(subject).not_to be_valid
- expect(subject.errors.symbols_for(:date_range)).to include(:start_date_must_be_before_end_date)
+ expect(subject.errors.symbols_for(:date_range)).to include(:start_date_must_be_before_finish_date)
end
- it "does not add errors if start_date is before or equal to end_date" do
+ it "does not add errors if start_date is before or equal to finish_date" do
subject.start_date = Time.zone.today
- subject.end_date = Time.zone.today
+ subject.finish_date = Time.zone.today
expect(subject).not_to be_valid
expect(subject.errors[:date_range]).to be_empty
end
@@ -112,37 +112,37 @@ RSpec.describe Project::Phase do
allow(Day).to receive(:working)
subject.start_date = nil
- subject.end_date = nil
+ subject.finish_date = nil
expect(subject.working_days_count).to be_nil
expect(Day).not_to have_received(:working)
end
- it "returns the correct number of days if start_date and end_date are the same" do
+ it "returns the correct number of days if start_date and finish_date are the same" do
subject.start_date = Time.zone.today
- subject.end_date = Time.zone.today
+ subject.finish_date = Time.zone.today
expect(subject.working_days_count).to eq(1)
end
it "returns the correct number of days for a valid date range" do
subject.start_date = Date.parse("2024-11-25")
- subject.end_date = Date.parse("2024-11-27")
+ subject.finish_date = Date.parse("2024-11-27")
expect(subject.working_days_count).to eq(3)
end
it "calls the Day.working.from_range method with the right arguments" do
subject.start_date = Date.parse("2024-11-25")
- subject.end_date = Date.parse("2024-11-27")
+ subject.finish_date = Date.parse("2024-11-27")
allow(Day).to receive(:working).and_return(Day)
allow(Day).to receive(:from_range)
- .with(from: subject.start_date, to: subject.end_date)
+ .with(from: subject.start_date, to: subject.finish_date)
.and_return([])
expect(subject.working_days_count).to eq(0)
expect(Day).to have_received(:working).with(no_args)
- expect(Day).to have_received(:from_range).with(from: subject.start_date, to: subject.end_date)
+ expect(Day).to have_received(:from_range).with(from: subject.start_date, to: subject.finish_date)
end
end
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index d1225e86533..930baefc149 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -412,7 +412,7 @@ RSpec.describe Project do
create(:user, member_with_permissions: { project => %i(view_project view_project_phases) })
end
let!(:project_phase) do
- create :project_phase, :skip_validate, project:, start_date: Date.new(3000, 1, 1), end_date: Date.new(2000, 1, 1)
+ create :project_phase, :skip_validate, project:, start_date: Date.new(3000, 1, 1), finish_date: Date.new(2000, 1, 1)
end
current_user { user }
diff --git a/spec/models/projects/project_acts_as_journalized_spec.rb b/spec/models/projects/project_acts_as_journalized_spec.rb
index 13681863cf0..58fcd65d328 100644
--- a/spec/models/projects/project_acts_as_journalized_spec.rb
+++ b/spec/models/projects/project_acts_as_journalized_spec.rb
@@ -206,9 +206,9 @@ RSpec.describe Project, "acts_as_journalized" do
describe "phases", with_settings: { journal_aggregation_time_minutes: 0 } do
describe "activation/deactivation" do
- let(:phase1) { build(:project_phase, project:, active: true, start_date: nil, end_date: nil) }
- let(:phase2) { build(:project_phase, project:, active: false, start_date: nil, end_date: nil) }
- let(:phase3) { build(:project_phase, project:, active: true, start_date: nil, end_date: nil) }
+ let(:phase1) { build(:project_phase, project:, active: true, start_date: nil, finish_date: nil) }
+ let(:phase2) { build(:project_phase, project:, active: false, start_date: nil, finish_date: nil) }
+ let(:phase3) { build(:project_phase, project:, active: true, start_date: nil, finish_date: nil) }
context "when adding" do
it "contains the change" do
@@ -244,10 +244,10 @@ RSpec.describe Project, "acts_as_journalized" do
end
describe "modifying dates" do
- let!(:phase1) { create(:project_phase, project:, start_date: original1&.begin, end_date: original1&.end) }
- let!(:phase2) { create(:project_phase, project:, start_date: original2&.begin, end_date: original2&.end) }
- let!(:phase3) { create(:project_phase, project:, start_date: original3&.begin, end_date: original3&.end) }
- let!(:phase4) { create(:project_phase, project:, start_date: original4&.begin, end_date: original4&.end) }
+ let!(:phase1) { create(:project_phase, project:, start_date: original1&.begin, finish_date: original1&.end) }
+ let!(:phase2) { create(:project_phase, project:, start_date: original2&.begin, finish_date: original2&.end) }
+ let!(:phase3) { create(:project_phase, project:, start_date: original3&.begin, finish_date: original3&.end) }
+ let!(:phase4) { create(:project_phase, project:, start_date: original4&.begin, finish_date: original4&.end) }
before do
project.save!
@@ -260,8 +260,8 @@ RSpec.describe Project, "acts_as_journalized" do
let(:original4) { nil }
it "contains the change" do
- phase1.update(start_date: Date.new(2025, 1, 28), end_date: Date.new(2025, 1, 29))
- phase2.update(start_date: Date.new(2025, 1, 30), end_date: Date.new(2025, 1, 31))
+ phase1.update(start_date: Date.new(2025, 1, 28), finish_date: Date.new(2025, 1, 29))
+ phase2.update(start_date: Date.new(2025, 1, 30), finish_date: Date.new(2025, 1, 31))
project.save!
expect(project.last_journal.details).to match(
@@ -286,9 +286,9 @@ RSpec.describe Project, "acts_as_journalized" do
let(:original4) { Date.new(2025, 2, 5)..Date.new(2025, 2, 7) }
it "contains the change" do
- phase1.update(start_date: Date.new(2025, 1, 1), end_date: Date.new(2025, 1, 7))
- phase2.update(start_date: Date.new(2025, 1, 16), end_date: Date.new(2025, 1, 18))
- phase3.update(start_date: Date.new(2025, 1, 25), end_date: Date.new(2025, 1, 31))
+ phase1.update(start_date: Date.new(2025, 1, 1), finish_date: Date.new(2025, 1, 7))
+ phase2.update(start_date: Date.new(2025, 1, 16), finish_date: Date.new(2025, 1, 18))
+ phase3.update(start_date: Date.new(2025, 1, 25), finish_date: Date.new(2025, 1, 31))
project.save!
expect(project.last_journal.details).to match(
@@ -317,8 +317,8 @@ RSpec.describe Project, "acts_as_journalized" do
let(:original4) { Date.new(2025, 2, 5)..Date.new(2025, 2, 7) }
it "contains the change" do
- phase1.update(start_date: nil, end_date: nil)
- phase2.update(start_date: nil, end_date: nil)
+ phase1.update(start_date: nil, finish_date: nil)
+ phase2.update(start_date: nil, finish_date: nil)
project.save!
expect(project.last_journal.details).to match(
@@ -339,10 +339,10 @@ RSpec.describe Project, "acts_as_journalized" do
describe "combined" do
let(:phase1) do
- build(:project_phase, project:, active: true, start_date: Date.new(2025, 1, 28), end_date: Date.new(2025, 1, 29))
+ build(:project_phase, project:, active: true, start_date: Date.new(2025, 1, 28), finish_date: Date.new(2025, 1, 29))
end
let(:phase2) do
- build(:project_phase, project:, active: false, start_date: Date.new(2025, 1, 30), end_date: Date.new(2025, 1, 31))
+ build(:project_phase, project:, active: false, start_date: Date.new(2025, 1, 30), finish_date: Date.new(2025, 1, 31))
end
it "contains both changes" do
diff --git a/spec/models/queries/projects/filters/project_phase_filter_spec.rb b/spec/models/queries/projects/filters/project_phase_filter_spec.rb
index ac70fa2a378..84f6a4a6dc7 100644
--- a/spec/models/queries/projects/filters/project_phase_filter_spec.rb
+++ b/spec/models/queries/projects/filters/project_phase_filter_spec.rb
@@ -32,7 +32,7 @@ require "spec_helper"
RSpec.describe Queries::Projects::Filters::ProjectPhaseFilter do
let(:phase) { build_stubbed(:project_phase_definition) }
- let(:phase_with_end_gate) { build_stubbed(:project_phase_definition, end_gate: true) }
+ let(:phase_with_finish_gate) { build_stubbed(:project_phase_definition, finish_gate: true) }
let(:phase_with_start_gate) { build_stubbed(:project_phase_definition, start_gate: true) }
let(:query) { build_stubbed(:project_query) }
@@ -43,7 +43,7 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseFilter do
before do
allow(Project::PhaseDefinition)
.to receive(:all)
- .and_return([phase, phase_with_end_gate, phase_with_start_gate])
+ .and_return([phase, phase_with_finish_gate, phase_with_start_gate])
end
describe ".create!" do
@@ -69,7 +69,7 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseFilter do
expect(described_class.all_for.map(&:human_name))
.to contain_exactly(I18n.t("project.filters.project_phase", phase: phase.name),
- I18n.t("project.filters.project_phase", phase: phase_with_end_gate.name),
+ I18n.t("project.filters.project_phase", phase: phase_with_finish_gate.name),
I18n.t("project.filters.project_phase", phase: phase_with_start_gate.name))
end
end
diff --git a/spec/models/queries/projects/filters/project_phase_gate_filter_spec.rb b/spec/models/queries/projects/filters/project_phase_gate_filter_spec.rb
index d13ef593538..152f1d99897 100644
--- a/spec/models/queries/projects/filters/project_phase_gate_filter_spec.rb
+++ b/spec/models/queries/projects/filters/project_phase_gate_filter_spec.rb
@@ -32,11 +32,11 @@ require "spec_helper"
RSpec.describe Queries::Projects::Filters::ProjectPhaseGateFilter do
let(:phase) { build_stubbed(:project_phase_definition) }
- let(:phase_with_end_gate) do
+ let(:phase_with_finish_gate) do
build_stubbed(:project_phase_definition,
name: "End gated phase",
- end_gate: true,
- end_gate_name: "End gate")
+ finish_gate: true,
+ finish_gate_name: "Finish gate")
end
let(:phase_with_start_gate) do
build_stubbed(:project_phase_definition,
@@ -47,8 +47,8 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseGateFilter do
let(:phase_with_both_gates) do
build_stubbed(:project_phase_definition,
name: "Double gated phase",
- end_gate: true,
- end_gate_name: "End gate of two",
+ finish_gate: true,
+ finish_gate_name: "Finish gate of two",
start_gate: true,
start_gate_name: "Start gate of two")
end
@@ -61,7 +61,7 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseGateFilter do
before do
allow(Project::PhaseDefinition)
.to receive(:all)
- .and_return([phase, phase_with_start_gate, phase_with_end_gate, phase_with_both_gates])
+ .and_return([phase, phase_with_start_gate, phase_with_finish_gate, phase_with_both_gates])
end
describe ".create!" do
@@ -74,21 +74,21 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseGateFilter do
context "for an existing end gate" do
it "returns a filter based on the gate" do
- expect(described_class.create!(name: "project_end_gate_#{phase_with_both_gates.id}", context: query))
+ expect(described_class.create!(name: "project_finish_gate_#{phase_with_both_gates.id}", context: query))
.to be_a described_class
end
end
context "for an existing phase but without a start gate" do
it "returns a filter based on the gate" do
- expect { described_class.create!(name: "project_start_gate_#{phase_with_end_gate.id}", context: query) }
+ expect { described_class.create!(name: "project_start_gate_#{phase_with_finish_gate.id}", context: query) }
.to raise_error Queries::Filters::InvalidError
end
end
context "for an existing phase but without an end gate" do
it "returns a filter based on the gate" do
- expect { described_class.create!(name: "project_end_gate_#{phase_with_start_gate.id}", context: query) }
+ expect { described_class.create!(name: "project_finish_gate_#{phase_with_start_gate.id}", context: query) }
.to raise_error Queries::Filters::InvalidError
end
end
@@ -102,7 +102,7 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseGateFilter do
context "for a non existing end phase" do
it "raise an error" do
- expect { described_class.create!(name: "project_end_gate_-1", context: query) }
+ expect { described_class.create!(name: "project_finish_gate_-1", context: query) }
.to raise_error Queries::Filters::InvalidError
end
end
@@ -114,17 +114,17 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseGateFilter do
.to all(be_a(described_class))
expect(described_class.all_for.map(&:human_name))
- .to contain_exactly(I18n.t("project.filters.project_phase_gate", gate: phase_with_end_gate.end_gate_name),
+ .to contain_exactly(I18n.t("project.filters.project_phase_gate", gate: phase_with_finish_gate.finish_gate_name),
I18n.t("project.filters.project_phase_gate", gate: phase_with_start_gate.start_gate_name),
I18n.t("project.filters.project_phase_gate", gate: phase_with_both_gates.start_gate_name),
- I18n.t("project.filters.project_phase_gate", gate: phase_with_both_gates.end_gate_name))
+ I18n.t("project.filters.project_phase_gate", gate: phase_with_both_gates.finish_gate_name))
end
end
describe ".key" do
it "is a regex for matching lifecycle steps" do
expect(described_class.key)
- .to eql(/\Aproject_(?<gate>end|start)_gate_(?<id>\d+)\z/)
+ .to eql(/\Aproject_(?<gate>finish|start)_gate_(?<id>\d+)\z/)
end
end
@@ -139,11 +139,11 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseGateFilter do
end
context "for an end gate" do
- let(:accessor) { "project_end_gate_#{phase_with_both_gates.id}" }
+ let(:accessor) { "project_finish_gate_#{phase_with_both_gates.id}" }
it "is the name of the gate with a prefix" do
expect(instance.human_name)
- .to eql I18n.t("project.filters.project_phase_gate", gate: phase_with_both_gates.end_gate_name)
+ .to eql I18n.t("project.filters.project_phase_gate", gate: phase_with_both_gates.finish_gate_name)
end
end
end
diff --git a/spec/models/queries/projects/project_query_results_project_phase_any_spec.rb b/spec/models/queries/projects/project_query_results_project_phase_any_spec.rb
index bdd8705de12..186c34c4ba0 100644
--- a/spec/models/queries/projects/project_query_results_project_phase_any_spec.rb
+++ b/spec/models/queries/projects/project_query_results_project_phase_any_spec.rb
@@ -36,10 +36,10 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
shared_let(:view_role) { create(:project_role, permissions: %i[view_project_phases]) }
shared_let(:phase_start_date) { Date.parse("2025-02-07") }
- shared_let(:phase_end_date) { Date.parse("2025-02-17") }
+ shared_let(:phase_finish_date) { Date.parse("2025-02-17") }
shared_let(:project_with_phase) { create(:project, name: "Project with phase") }
shared_let(:phase) do
- create(:project_phase, project: project_with_phase, start_date: phase_start_date, end_date: phase_end_date)
+ create(:project_phase, project: project_with_phase, start_date: phase_start_date, finish_date: phase_finish_date)
end
shared_let(:project_without_phase) { create(:project, name: "Project without phase") }
@@ -68,7 +68,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
def self.remove_phase_dates
before do
- phase.update_columns(end_date: nil, start_date: nil)
+ phase.update_columns(finish_date: nil, start_date: nil)
end
end
@@ -91,7 +91,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when filtering in the middle of the phase" do
- let(:values) { [(phase_start_date + ((phase_end_date - phase_start_date) / 2)).to_s] }
+ let(:values) { [(phase_start_date + ((phase_finish_date - phase_start_date) / 2)).to_s] }
it "returns the project whose phase is covering an interval including the date" do
expect(instance.results).to contain_exactly(project_with_phase)
@@ -107,7 +107,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when filtering on the last day of the phase" do
- let(:values) { [phase_end_date.to_s] }
+ let(:values) { [phase_finish_date.to_s] }
it "returns the project whose phase ends on that date" do
expect(instance.results).to contain_exactly(project_with_phase)
@@ -123,7 +123,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when filtering after the phase" do
- let(:values) { [(phase_end_date + 1.day).to_s] }
+ let(:values) { [(phase_finish_date + 1.day).to_s] }
it "returns no project" do
expect(instance.results).to be_empty
@@ -131,7 +131,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when the phase has no dates" do
- let(:values) { [phase_end_date.to_s] }
+ let(:values) { [phase_finish_date.to_s] }
remove_phase_dates
@@ -141,7 +141,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when filtering in the middle of the phase but with the phase being inactive" do
- let(:values) { [(phase_start_date + ((phase_end_date - phase_start_date) / 2)).to_s] }
+ let(:values) { [(phase_start_date + ((phase_finish_date - phase_start_date) / 2)).to_s] }
disable_phase
@@ -151,7 +151,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when filtering in the middle of the phase but without permissions" do
- let(:values) { [(phase_start_date + ((phase_end_date - phase_start_date) / 2)).to_s] }
+ let(:values) { [(phase_start_date + ((phase_finish_date - phase_start_date) / 2)).to_s] }
remove_permissions
@@ -168,7 +168,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
context "when being in the middle of the phase" do
it "returns the project whose phase is currently running" do
- Timecop.travel((phase_start_date + (phase_end_date - phase_start_date)).noon) do
+ Timecop.travel((phase_start_date + (phase_finish_date - phase_start_date)).noon) do
expect(instance.results).to contain_exactly(project_with_phase)
end
end
@@ -184,7 +184,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
context "when being on the last day of the phase" do
it "returns the project whose phase begins on that date" do
- Timecop.travel(phase_end_date.noon) do
+ Timecop.travel(phase_finish_date.noon) do
expect(instance.results).to contain_exactly(project_with_phase)
end
end
@@ -200,7 +200,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
context "when being after the phase" do
it "returns no project" do
- Timecop.travel(phase_end_date.noon + 1.day) do
+ Timecop.travel(phase_finish_date.noon + 1.day) do
expect(instance.results).to be_empty
end
end
@@ -210,7 +210,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
remove_phase_dates
it "returns no project" do
- Timecop.travel(phase_end_date.noon) do
+ Timecop.travel(phase_finish_date.noon) do
expect(instance.results).to be_empty
end
end
@@ -220,7 +220,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
disable_phase
it "returns no project" do
- Timecop.travel((phase_start_date + (phase_end_date - phase_start_date)).noon) do
+ Timecop.travel((phase_start_date + (phase_finish_date - phase_start_date)).noon) do
expect(instance.results).to be_empty
end
end
@@ -230,7 +230,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
remove_permissions
it "returns no project" do
- Timecop.travel((phase_start_date + (phase_end_date - phase_start_date)).noon) do
+ Timecop.travel((phase_start_date + (phase_finish_date - phase_start_date)).noon) do
expect(instance.results).to be_empty
end
end
@@ -260,7 +260,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
context "when the current week overlaps the end of the phase" do
it "returns the project whose phase begins within the week" do
- Timecop.travel(phase_end_date.noon) do
+ Timecop.travel(phase_finish_date.noon) do
expect(instance.results).to contain_exactly(project_with_phase)
end
end
@@ -276,7 +276,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
context "when being after the phase" do
it "returns no project" do
- Timecop.travel(phase_end_date.noon + 7.days) do
+ Timecop.travel(phase_finish_date.noon + 7.days) do
expect(instance.results).to be_empty
end
end
@@ -286,7 +286,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
remove_phase_dates
it "returns no project" do
- Timecop.travel(phase_end_date.noon + 7.days) do
+ Timecop.travel(phase_finish_date.noon + 7.days) do
expect(instance.results).to be_empty
end
end
@@ -315,7 +315,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
context "when being on Monday, the phase ends on Sunday and the week is configured to start on Sunday",
with_settings: { start_of_week: 7 } do
before do
- phase.update_column(:end_date, Date.parse("2025-02-16"))
+ phase.update_column(:finish_date, Date.parse("2025-02-16"))
end
it "returns the project whose phase has ended within the current week" do
@@ -328,7 +328,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
context "when being on Monday, the phase ends on Sunday and the week is configured to start on Monday",
with_settings: { start_of_week: 1 } do
before do
- phase.update_column(:end_date, Date.parse("2025-02-16"))
+ phase.update_column(:finish_date, Date.parse("2025-02-16"))
end
it "returns no project as the phase ended in the week before" do
@@ -341,7 +341,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
context "when being on Sunday, the phase ends on Monday and the week is configured to start on Monday",
with_settings: { start_of_week: 1 } do
before do
- phase.update_column(:end_date, Date.parse("2025-02-17"))
+ phase.update_column(:finish_date, Date.parse("2025-02-17"))
end
it "returns the project whose phase has ended within the current week" do
@@ -354,7 +354,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
context "when being on Sunday, the phase ends on Monday and the week is configured to start on Sunday",
with_settings: { start_of_week: 7 } do
before do
- phase.update_column(:end_date, Date.parse("2025-02-17"))
+ phase.update_column(:finish_date, Date.parse("2025-02-17"))
end
it "returns no project as the phase ended in the week before" do
@@ -371,7 +371,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when encompassing the phase completely" do
- let(:values) { [(phase_start_date - 1.day).to_s, (phase_end_date + 1.day).to_s] }
+ let(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }
it "returns the project with the phase" do
expect(instance.results).to contain_exactly(project_with_phase)
@@ -379,7 +379,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when encompassing the phase precisely" do
- let(:values) { [phase_start_date.to_s, phase_end_date.to_s] }
+ let(:values) { [phase_start_date.to_s, phase_finish_date.to_s] }
it "returns the project with the phase" do
expect(instance.results).to contain_exactly(project_with_phase)
@@ -387,7 +387,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when the values overlap the phase's start date but not the end date" do
- let(:values) { [(phase_start_date - 1.day).to_s, (phase_end_date - 1.day).to_s] }
+ let(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date - 1.day).to_s] }
it "returns no project" do
expect(instance.results).to be_empty
@@ -395,7 +395,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when the values overlap the phase's end date but not the start date" do
- let(:values) { [(phase_start_date + 1.day).to_s, phase_end_date.to_s] }
+ let(:values) { [(phase_start_date + 1.day).to_s, phase_finish_date.to_s] }
it "returns no project" do
expect(instance.results).to be_empty
@@ -403,7 +403,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when the values are between the start and the end date of the phase" do
- let(:values) { [(phase_start_date + 1.day).to_s, (phase_end_date - 1.day).to_s] }
+ let(:values) { [(phase_start_date + 1.day).to_s, (phase_finish_date - 1.day).to_s] }
it "returns no project" do
expect(instance.results).to be_empty
@@ -435,7 +435,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when only the upper value is provided and that one is after the phase's end date" do
- let(:values) { ["", (phase_end_date + 1.day).to_s] }
+ let(:values) { ["", (phase_finish_date + 1.day).to_s] }
it "returns the project with the phase" do
expect(instance.results).to contain_exactly(project_with_phase)
@@ -443,7 +443,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when the phase has no dates" do
- let(:values) { [(phase_start_date - 1.day).to_s, (phase_end_date + 1.day).to_s] }
+ let(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }
remove_phase_dates
@@ -461,7 +461,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when encompassing the phase completely but with the phase disabled" do
- let(:values) { [(phase_start_date - 1.day).to_s, (phase_end_date + 1.day).to_s] }
+ let(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }
disable_phase
@@ -471,7 +471,7 @@ RSpec.describe ProjectQuery, "results of 'Project phase: Any' filter" do
end
context "when encompassing the phase completely but without permissions" do
- let(:values) { [(phase_start_date - 1.day).to_s, (phase_end_date + 1.day).to_s] }
+ let(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }
remove_permissions
diff --git a/spec/models/queries/projects/project_query_results_project_phase_gate_spec.rb b/spec/models/queries/projects/project_query_results_project_phase_gate_spec.rb
index 15577996fae..3225bb1631d 100644
--- a/spec/models/queries/projects/project_query_results_project_phase_gate_spec.rb
+++ b/spec/models/queries/projects/project_query_results_project_phase_gate_spec.rb
@@ -35,26 +35,26 @@ RSpec.describe ProjectQuery, "results of a project phase gate filter" do
shared_let(:view_role) { create(:project_role, permissions: %i[view_project_phases]) }
- shared_let(:gate_definition) { create(:project_phase_definition, :with_start_gate, :with_end_gate) }
+ shared_let(:gate_definition) { create(:project_phase_definition, :with_start_gate, :with_finish_gate) }
shared_let(:start_gate_date) { Date.parse("2025-03-04") }
- shared_let(:end_gate_date) { Date.parse("2025-03-07") }
+ shared_let(:finish_gate_date) { Date.parse("2025-03-07") }
shared_let(:project_with_gate) { create(:project, name: "Project with gate") }
shared_let(:gate) do
create(:project_phase,
project: project_with_gate,
start_date: start_gate_date,
- end_date: end_gate_date,
+ finish_date: finish_gate_date,
definition: gate_definition)
end
# This is added to ensure that the filter only works on the gate provided.
- shared_let(:rival_gate_definition) { create(:project_phase_definition, :with_start_gate, :with_end_gate) }
+ shared_let(:rival_gate_definition) { create(:project_phase_definition, :with_start_gate, :with_finish_gate) }
shared_let(:project_with_rival_gate) { create(:project, name: "Project with rival gate") }
shared_let(:rival_gate) do
create(:project_phase,
project: project_with_rival_gate,
start_date: start_gate_date,
- end_date: end_gate_date,
+ finish_date: finish_gate_date,
definition: rival_gate_definition)
end
@@ -468,9 +468,9 @@ RSpec.describe ProjectQuery, "results of a project phase gate filter" do
it_behaves_like "a project phase gate filter"
end
- context "for a gate on the end date" do
- let(:boundary) { "end" }
- let(:filter_reference_date) { end_gate_date }
+ context "for a gate on the finish date" do
+ let(:boundary) { "finish" }
+ let(:filter_reference_date) { finish_gate_date }
it_behaves_like "a project phase gate filter"
end
diff --git a/spec/models/queries/projects/project_query_results_project_phase_spec.rb b/spec/models/queries/projects/project_query_results_project_phase_spec.rb
index 64c32feaf3f..dad5aec96c1 100644
--- a/spec/models/queries/projects/project_query_results_project_phase_spec.rb
+++ b/spec/models/queries/projects/project_query_results_project_phase_spec.rb
@@ -37,16 +37,16 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
shared_let(:view_role) { create(:project_role, permissions: %i[view_project_phases]) }
shared_let(:phase_start_date) { Date.parse("2025-02-07") }
- shared_let(:phase_end_date) { Date.parse("2025-02-17") }
+ shared_let(:phase_finish_date) { Date.parse("2025-02-17") }
shared_let(:project_with_phase) { create(:project, name: "Project with stage") }
shared_let(:stage) do
- create(:project_phase, project: project_with_phase, start_date: phase_start_date, end_date: phase_end_date)
+ create(:project_phase, project: project_with_phase, start_date: phase_start_date, finish_date: phase_finish_date)
end
# This is added to ensure that the filter only works on the stage provided.
shared_let(:project_with_rival_phase) { create(:project, name: "Project with rival stage") }
shared_let(:rival_stage) do
- create(:project_phase, project: project_with_rival_phase, start_date: phase_start_date, end_date: phase_end_date)
+ create(:project_phase, project: project_with_rival_phase, start_date: phase_start_date, finish_date: phase_finish_date)
end
shared_let(:project_without_phase) { create(:project, name: "Project without phase") }
@@ -70,7 +70,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
def self.remove_phase_dates
before do
- stage.update_columns(end_date: nil, start_date: nil)
+ stage.update_columns(finish_date: nil, start_date: nil)
end
end
@@ -93,7 +93,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when filtering in the middle of the stage" do
- let(:values) { [(phase_start_date + ((phase_end_date - phase_start_date) / 2)).to_s] }
+ let(:values) { [(phase_start_date + ((phase_finish_date - phase_start_date) / 2)).to_s] }
it "returns the project whose stage is covering an interval including the date" do
expect(instance.results).to contain_exactly(project_with_phase)
@@ -109,7 +109,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when filtering on the last day of the stage" do
- let(:values) { [phase_end_date.to_s] }
+ let(:values) { [phase_finish_date.to_s] }
it "returns the project whose stage ends on that date" do
expect(instance.results).to contain_exactly(project_with_phase)
@@ -125,7 +125,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when filtering after the stage" do
- let(:values) { [(phase_end_date + 1.day).to_s] }
+ let(:values) { [(phase_finish_date + 1.day).to_s] }
it "returns no project" do
expect(instance.results).to be_empty
@@ -133,7 +133,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when the stage has no dates" do
- let(:values) { [phase_end_date.to_s] }
+ let(:values) { [phase_finish_date.to_s] }
remove_phase_dates
@@ -143,7 +143,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when filtering in the middle of the stage but with the stage being inactive" do
- let(:values) { [(phase_start_date + ((phase_end_date - phase_start_date) / 2)).to_s] }
+ let(:values) { [(phase_start_date + ((phase_finish_date - phase_start_date) / 2)).to_s] }
disable_phase
@@ -153,7 +153,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when filtering in the middle of the stage but without permissions" do
- let(:values) { [(phase_start_date + ((phase_end_date - phase_start_date) / 2)).to_s] }
+ let(:values) { [(phase_start_date + ((phase_finish_date - phase_start_date) / 2)).to_s] }
remove_permissions
@@ -170,7 +170,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
context "when being in the middle of the stage" do
it "returns the project whose stage is currently running" do
- Timecop.travel((phase_start_date + (phase_end_date - phase_start_date)).noon) do
+ Timecop.travel((phase_start_date + (phase_finish_date - phase_start_date)).noon) do
expect(instance.results).to contain_exactly(project_with_phase)
end
end
@@ -186,7 +186,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
context "when being on the last day of the stage" do
it "returns the project whose stage begins on that date" do
- Timecop.travel(phase_end_date.noon) do
+ Timecop.travel(phase_finish_date.noon) do
expect(instance.results).to contain_exactly(project_with_phase)
end
end
@@ -202,7 +202,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
context "when being after the stage" do
it "returns no project" do
- Timecop.travel(phase_end_date.noon + 1.day) do
+ Timecop.travel(phase_finish_date.noon + 1.day) do
expect(instance.results).to be_empty
end
end
@@ -220,7 +220,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
disable_phase
it "returns no project" do
- Timecop.travel((phase_start_date + (phase_end_date - phase_start_date)).noon) do
+ Timecop.travel((phase_start_date + (phase_finish_date - phase_start_date)).noon) do
expect(instance.results).to be_empty
end
end
@@ -230,7 +230,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
remove_permissions
it "returns no project" do
- Timecop.travel((phase_start_date + (phase_end_date - phase_start_date)).noon) do
+ Timecop.travel((phase_start_date + (phase_finish_date - phase_start_date)).noon) do
expect(instance.results).to be_empty
end
end
@@ -260,7 +260,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
context "when the current week overlaps the end of the stage" do
it "returns the project whose stage begins within the week" do
- Timecop.travel(phase_end_date.noon) do
+ Timecop.travel(phase_finish_date.noon) do
expect(instance.results).to contain_exactly(project_with_phase)
end
end
@@ -276,7 +276,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
context "when being after the stage" do
it "returns no project" do
- Timecop.travel(phase_end_date.noon + 7.days) do
+ Timecop.travel(phase_finish_date.noon + 7.days) do
expect(instance.results).to be_empty
end
end
@@ -286,7 +286,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
remove_phase_dates
it "returns no project" do
- Timecop.travel(phase_end_date.noon + 7.days) do
+ Timecop.travel(phase_finish_date.noon + 7.days) do
expect(instance.results).to be_empty
end
end
@@ -315,7 +315,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
context "when being on Monday, the stage ends on Sunday and the week is configured to start on Sunday",
with_settings: { start_of_week: 7 } do
before do
- stage.update_column(:end_date, Date.parse("2025-02-16"))
+ stage.update_column(:finish_date, Date.parse("2025-02-16"))
end
it "returns the project whose stage has ended within the current week" do
@@ -328,7 +328,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
context "when being on Monday, the stage ends on Sunday and the week is configured to start on Monday",
with_settings: { start_of_week: 1 } do
before do
- stage.update_column(:end_date, Date.parse("2025-02-16"))
+ stage.update_column(:finish_date, Date.parse("2025-02-16"))
end
it "returns no project as the stage ended in the week before" do
@@ -341,7 +341,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
context "when being on Sunday, the stage ends on Monday and the week is configured to start on Monday",
with_settings: { start_of_week: 1 } do
before do
- stage.update_column(:end_date, Date.parse("2025-02-17"))
+ stage.update_column(:finish_date, Date.parse("2025-02-17"))
end
it "returns the project whose stage has ended within the current week" do
@@ -354,7 +354,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
context "when being on Sunday, the stage ends on Monday and the week is configured to start on Sunday",
with_settings: { start_of_week: 7 } do
before do
- stage.update_column(:end_date, Date.parse("2025-02-17"))
+ stage.update_column(:finish_date, Date.parse("2025-02-17"))
end
it "returns no project as the stage ended in the week before" do
@@ -371,7 +371,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when encompassing the stage completely" do
- let(:values) { [(phase_start_date - 1.day).to_s, (phase_end_date + 1.day).to_s] }
+ let(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }
it "returns the project with the stage" do
expect(instance.results).to contain_exactly(project_with_phase)
@@ -379,7 +379,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when encompassing the stage precisely" do
- let(:values) { [phase_start_date.to_s, phase_end_date.to_s] }
+ let(:values) { [phase_start_date.to_s, phase_finish_date.to_s] }
it "returns the project with the stage" do
expect(instance.results).to contain_exactly(project_with_phase)
@@ -387,7 +387,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when the values overlap the stage's start date but not the end date" do
- let(:values) { [(phase_start_date - 1.day).to_s, (phase_end_date - 1.day).to_s] }
+ let(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date - 1.day).to_s] }
it "returns no project" do
expect(instance.results).to be_empty
@@ -395,7 +395,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when the values overlap the stage's end date but not the start date" do
- let(:values) { [(phase_start_date + 1.day).to_s, phase_end_date.to_s] }
+ let(:values) { [(phase_start_date + 1.day).to_s, phase_finish_date.to_s] }
it "returns no project" do
expect(instance.results).to be_empty
@@ -403,7 +403,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when the values are between the start and the end date of the stage" do
- let(:values) { [(phase_start_date + 1.day).to_s, (phase_end_date - 1.day).to_s] }
+ let(:values) { [(phase_start_date + 1.day).to_s, (phase_finish_date - 1.day).to_s] }
it "returns no project" do
expect(instance.results).to be_empty
@@ -435,7 +435,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when only the upper value is provided and that one is after the stage's end date" do
- let(:values) { ["", (phase_end_date + 1.day).to_s] }
+ let(:values) { ["", (phase_finish_date + 1.day).to_s] }
it "returns the project with the stage" do
expect(instance.results).to contain_exactly(project_with_phase)
@@ -443,7 +443,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when the stage has no dates" do
- let(:values) { [(phase_start_date - 1.day).to_s, (phase_end_date + 1.day).to_s] }
+ let(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }
remove_phase_dates
@@ -461,7 +461,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when encompassing the stage completely but with the stage disabled" do
- let(:values) { [(phase_start_date - 1.day).to_s, (phase_end_date + 1.day).to_s] }
+ let(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }
disable_phase
@@ -471,7 +471,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" do
end
context "when encompassing the stage completely but without permissions" do
- let(:values) { [(phase_start_date - 1.day).to_s, (phase_end_date + 1.day).to_s] }
+ let(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }
remove_permissions
diff --git a/spec/support/components/projects/project_life_cycles/edit_dialog.rb b/spec/support/components/projects/project_life_cycles/edit_dialog.rb
index 19d115d3907..17db68ba13b 100644
--- a/spec/support/components/projects/project_life_cycles/edit_dialog.rb
+++ b/spec/support/components/projects/project_life_cycles/edit_dialog.rb
@@ -109,7 +109,7 @@ module Components
end
def expect_input_for(step)
- value = "#{step.start_date.strftime('%Y-%m-%d')} - #{step.end_date.strftime('%Y-%m-%d')}"
+ value = "#{step.start_date.strftime('%Y-%m-%d')} - #{step.finish_date.strftime('%Y-%m-%d')}"
expect_input(step.name, value:, position: step.position)
end