Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove requestable state #1720

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/models/further_information_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# received_at :datetime
# requested_at :datetime
# reviewed_at :datetime
# state :string default("requested"), not null
# working_days_assessment_started_to_creation :integer
# working_days_received_to_recommendation :integer
# working_days_since_received :integer
Expand Down
1 change: 0 additions & 1 deletion app/models/professional_standing_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# received_at :datetime
# requested_at :datetime
# reviewed_at :datetime
# state :string default("requested"), not null
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
Expand Down
1 change: 0 additions & 1 deletion app/models/qualification_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# received_at :datetime
# requested_at :datetime
# reviewed_at :datetime
# state :string default("requested"), not null
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
Expand Down
1 change: 0 additions & 1 deletion app/models/reference_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
# satisfied_comment :text default(""), not null
# satisfied_response :boolean
# slug :string not null
# state :string default("requested"), not null
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
Expand Down
4 changes: 0 additions & 4 deletions config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@
- received_at
- requested_at
- reviewed_at
- state
- updated_at
- working_days_assessment_started_to_creation
- working_days_received_to_recommendation
Expand Down Expand Up @@ -225,7 +224,6 @@
- received_at
- requested_at
- reviewed_at
- state
- updated_at
:qualifications:
- id
Expand All @@ -251,7 +249,6 @@
- received_at
- requested_at
- reviewed_at
- state
- updated_at
:reference_requests:
- additional_information_response
Expand Down Expand Up @@ -283,7 +280,6 @@
- satisfied_comment
- satisfied_response
- slug
- state
- updated_at
- work_history_id
:regions:
Expand Down
16 changes: 0 additions & 16 deletions db/migrate/20230926101325_add_expired_at_to_requestables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,5 @@ def change
add_column :professional_standing_requests, :expired_at, :datetime
add_column :qualification_requests, :expired_at, :datetime
add_column :reference_requests, :expired_at, :datetime

FurtherInformationRequest.expired.each do |requestable|
requestable.update!(expired_at: requestable.expires_at)
end

ProfessionalStandingRequest.expired.each do |requestable|
requestable.update!(expired_at: requestable.expires_at)
end

QualificationRequest.expired.each do |requestable|
requestable.update!(expired_at: requestable.expires_at)
end

ReferenceRequest.expired.each do |requestable|
requestable.update!(expired_at: requestable.expires_at)
end
end
end
24 changes: 24 additions & 0 deletions db/migrate/20230926162102_remove_state_from_requestables.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class RemoveStateFromRequestables < ActiveRecord::Migration[7.0]
def change
remove_column :further_information_requests,
:state,
:string,
null: false,
default: "requested"
remove_column :professional_standing_requests,
:state,
:string,
null: false,
default: "requested"
remove_column :qualification_requests,
:state,
:string,
null: false,
default: "requested"
remove_column :reference_requests,
:state,
:string,
null: false,
default: "requested"
end
end
4 changes: 0 additions & 4 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 2 additions & 17 deletions lib/tasks/example_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,9 @@ def create_application_forms
)
elsif (work_history = application_form.work_histories.first) &&
rand(3).zero?
reference_request_trait = ReferenceRequest.states.keys.sample
FactoryBot.create(
:reference_request,
reference_request_trait,
%i[requested received expired].sample,
assessment:,
work_history:,
)
Expand All @@ -202,10 +201,9 @@ def create_application_forms
)
elsif (qualification = application_form.qualifications.first) &&
rand(2).zero?
qualification_trait = ReferenceRequest.states.keys.sample
FactoryBot.create(
:qualification_request,
qualification_trait,
%i[requested received expired].sample,
assessment:,
qualification:,
)
Expand All @@ -227,19 +225,6 @@ def create_application_forms
waiting_on_further_information: true,
)
end
elsif (work_history = application_form.work_histories.first) &&
rand(2).zero?
FactoryBot.create(
:reference_request,
%i[requested received expired].sample,
assessment:,
work_history:,
)
application_form.update!(
statuses: %w[waiting_on_reference],
stage: "verification",
waiting_on_reference: true,
)
end
end
end
Expand Down
1 change: 0 additions & 1 deletion spec/factories/further_information_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# received_at :datetime
# requested_at :datetime
# reviewed_at :datetime
# state :string default("requested"), not null
# working_days_assessment_started_to_creation :integer
# working_days_received_to_recommendation :integer
# working_days_since_received :integer
Expand Down
1 change: 0 additions & 1 deletion spec/factories/professional_standing_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# received_at :datetime
# requested_at :datetime
# reviewed_at :datetime
# state :string default("requested"), not null
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
Expand Down
1 change: 0 additions & 1 deletion spec/factories/qualification_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# received_at :datetime
# requested_at :datetime
# reviewed_at :datetime
# state :string default("requested"), not null
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
Expand Down
1 change: 0 additions & 1 deletion spec/factories/reference_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
# satisfied_comment :text default(""), not null
# satisfied_response :boolean
# slug :string not null
# state :string default("requested"), not null
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@

it { is_expected.to be true }

it "doesn't change the state" do
expect { save }.to_not change(requestable, :state)
end

it "sets ready for review" do
expect { save }.to change(requestable, :ready_for_review).to(true)
end
Expand All @@ -81,10 +77,6 @@

it { is_expected.to be true }

it "doesn't change the state" do
expect { save }.to_not change(requestable, :state)
end

it "doesn't set ready for review" do
expect { save }.to_not change(requestable, :ready_for_review)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@

it { is_expected.to be true }

it "doesn't change the state" do
expect { save }.to_not change(requestable, :state)
end

it "sets passed" do
expect { save }.to change(requestable, :passed).to(false)
end
Expand All @@ -149,10 +145,6 @@

it { is_expected.to be true }

it "doesn't change the state" do
expect { save }.to_not change(requestable, :state)
end

it "doesn't set passed" do
expect { save }.to_not change(requestable, :passed)
end
Expand Down
1 change: 0 additions & 1 deletion spec/models/further_information_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# received_at :datetime
# requested_at :datetime
# reviewed_at :datetime
# state :string default("requested"), not null
# working_days_assessment_started_to_creation :integer
# working_days_received_to_recommendation :integer
# working_days_since_received :integer
Expand Down
1 change: 0 additions & 1 deletion spec/models/professional_standing_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# received_at :datetime
# requested_at :datetime
# reviewed_at :datetime
# state :string default("requested"), not null
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
Expand Down
1 change: 0 additions & 1 deletion spec/models/qualification_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# received_at :datetime
# requested_at :datetime
# reviewed_at :datetime
# state :string default("requested"), not null
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
Expand Down
1 change: 0 additions & 1 deletion spec/models/reference_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
# satisfied_comment :text default(""), not null
# satisfied_response :boolean
# slug :string not null
# state :string default("requested"), not null
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
Expand Down
Loading