Skip to content

Commit

Permalink
Rename state_changed event_type
Browse files Browse the repository at this point in the history
We're going to rename this to `status_changed` to better represent how
we show it to users.
  • Loading branch information
thomasleese committed Sep 24, 2023
1 parent d968466 commit a16607c
Showing 5 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/components/timeline_entry/component.rb
Original file line number Diff line number Diff line change
@@ -41,16 +41,16 @@ def description_vars

private

def state_changed_vars
def status_changed_vars
{
old_state:
old_status:
render(
StatusTag::Component.new(
timeline_event.old_value,
class_context: "timeline-event",
),
).strip,
new_state:
new_status:
render(
StatusTag::Component.new(
timeline_event.new_value,
6 changes: 3 additions & 3 deletions app/models/timeline_event.rb
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ class TimelineEvent < ApplicationRecord
requestable_requested: "requestable_requested",
reviewer_assigned: "reviewer_assigned",
stage_changed: "stage_changed",
state_changed: "state_changed",
status_changed: "status_changed",
}

validates :creator, presence: true, unless: -> { creator_name.present? }
@@ -144,14 +144,14 @@ class TimelineEvent < ApplicationRecord
presence: true,
if: -> do
action_required_by_changed? || assessment_section_recorded? ||
information_changed? || stage_changed? || state_changed?
information_changed? || stage_changed? || status_changed?
end
validates :old_value,
:new_value,
absence: true,
unless: -> do
action_required_by_changed? || assessment_section_recorded? ||
information_changed? || stage_changed? || state_changed?
information_changed? || stage_changed? || status_changed?
end

validates :column_name, presence: true, if: :information_changed?
4 changes: 2 additions & 2 deletions config/locales/components.en.yml
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ en:
QualificationRequest: Qualification assessed
ReferenceRequest: Reference assessed
stage_changed: Stage changed
state_changed: Status changed
status_changed: Status changed
description:
action_required_by_changed: Application requires %{action} action.
assessor_assigned: "%{assignee_name} is assigned as the assessor."
@@ -106,7 +106,7 @@ en:
QualificationRequest: A qualification has been assessed.
ReferenceRequest: A reference has been assessed.
stage_changed: Stage changed from %{old_stage} to %{new_stage}.
state_changed: Status changed from %{old_state} to %{new_state}.
status_changed: Status changed from %{old_status} to %{new_status}.
columns:
contact_email: Reference email address
contact_job: Reference job
2 changes: 1 addition & 1 deletion spec/components/timeline_entry_spec.rb
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@
let(:timeline_event) do
create(
:timeline_event,
:state_changed,
:status_changed,
old_value: "submitted",
new_value: "awarded",
)
6 changes: 3 additions & 3 deletions spec/models/timeline_event_spec.rb
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@
requestable_requested: "requestable_requested",
reviewer_assigned: "reviewer_assigned",
stage_changed: "stage_changed",
state_changed: "state_changed",
status_changed: "status_changed",
).backed_by_column_of_type(:string)
end

@@ -136,8 +136,8 @@
it { is_expected.to validate_absence_of(:new_value) }
end

context "with a state changed event type" do
before { timeline_event.event_type = :state_changed }
context "with a status changed event type" do
before { timeline_event.event_type = :status_changed }

it { is_expected.to validate_absence_of(:assignee) }
it { is_expected.to validate_absence_of(:assessment_section) }

0 comments on commit a16607c

Please sign in to comment.