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 ready for review field #1757

Merged
merged 2 commits into from
Nov 9, 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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def edit_locate
requestable:,
user: current_staff,
received: requestable.received?,
ready_for_review: requestable.ready_for_review,
location_note: requestable.location_note,
)
end
Expand Down Expand Up @@ -170,7 +169,7 @@ def set_variables
def location_form_params
params.require(
:assessor_interface_professional_standing_request_location_form,
).permit(:received, :ready_for_review, :location_note)
).permit(:received, :location_note)
end

def review_form_params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ class AssessorInterface::ProfessionalStandingRequestLocationForm
attribute :received, :boolean
validates :received, inclusion: [true, false]

attribute :ready_for_review, :boolean
validates :ready_for_review, inclusion: [true, false], unless: :received

attribute :location_note, :string

def save
Expand All @@ -30,10 +27,7 @@ def save
ApplicationFormStatusUpdater.call(application_form:, user:)
end

requestable.update!(
location_note: location_note.presence || "",
ready_for_review: ready_for_review || false,
)
requestable.update!(location_note: location_note.presence || "")
end

true
Expand Down
29 changes: 14 additions & 15 deletions app/models/professional_standing_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@
#
# Table name: professional_standing_requests
#
# id :bigint not null, primary key
# expired_at :datetime
# location_note :text default(""), not null
# ready_for_review :boolean default(FALSE), not null
# received_at :datetime
# requested_at :datetime
# review_note :string default(""), not null
# review_passed :boolean
# reviewed_at :datetime
# verified_at :datetime
# verify_note :text default(""), not null
# verify_passed :boolean
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
# id :bigint not null, primary key
# expired_at :datetime
# location_note :text default(""), not null
# received_at :datetime
# requested_at :datetime
# review_note :string default(""), not null
# review_passed :boolean
# reviewed_at :datetime
# verified_at :datetime
# verify_note :text default(""), not null
# verify_passed :boolean
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
#
# Indexes
#
Expand Down
1 change: 0 additions & 1 deletion config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@
- expired_at
- id
- location_note
- ready_for_review
- received_at
- requested_at
- review_note
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class RemoveReadyForReviewFromProfessionalStandingRequests < ActiveRecord::Migration[
7.1
]
def change
remove_column :professional_standing_requests,
:ready_for_review,
:boolean,
null: false,
default: false
end
end
3 changes: 1 addition & 2 deletions db/schema.rb

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

29 changes: 14 additions & 15 deletions spec/factories/professional_standing_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@
#
# Table name: professional_standing_requests
#
# id :bigint not null, primary key
# expired_at :datetime
# location_note :text default(""), not null
# ready_for_review :boolean default(FALSE), not null
# received_at :datetime
# requested_at :datetime
# review_note :string default(""), not null
# review_passed :boolean
# reviewed_at :datetime
# verified_at :datetime
# verify_note :text default(""), not null
# verify_passed :boolean
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
# id :bigint not null, primary key
# expired_at :datetime
# location_note :text default(""), not null
# received_at :datetime
# requested_at :datetime
# review_note :string default(""), not null
# review_passed :boolean
# reviewed_at :datetime
# verified_at :datetime
# verify_note :text default(""), not null
# verify_passed :boolean
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
#
# Indexes
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,16 @@
let(:user) { create(:staff) }

let(:received) { "" }
let(:ready_for_review) { "" }
let(:location_note) { "" }

subject(:form) do
described_class.new(
requestable:,
user:,
received:,
ready_for_review:,
location_note:,
)
described_class.new(requestable:, user:, received:, location_note:)
end

describe "validations" do
it { is_expected.to validate_presence_of(:requestable) }
it { is_expected.to validate_presence_of(:user) }
it { is_expected.to allow_values(true, false).for(:received) }
it { is_expected.to allow_values(true, false).for(:ready_for_review) }

context "when not received" do
let(:received) { "false" }

it { is_expected.to_not allow_values(nil).for(:ready_for_review) }
end
end

describe "#save" do
Expand Down Expand Up @@ -60,26 +46,10 @@
end
end

context "when not received and ready for review" do
let(:received) { "false" }
let(:ready_for_review) { "true" }

it { is_expected.to be true }

it "sets ready for review" do
expect { save }.to change(requestable, :ready_for_review).to(true)
end
end

context "when not received and not ready for review" do
context "when not received" do
let(:received) { "false" }
let(:ready_for_review) { "false" }

it { is_expected.to be true }

it "doesn't set ready for review" do
expect { save }.to_not change(requestable, :ready_for_review)
end
end
end
end
29 changes: 14 additions & 15 deletions spec/models/professional_standing_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@
#
# Table name: professional_standing_requests
#
# id :bigint not null, primary key
# expired_at :datetime
# location_note :text default(""), not null
# ready_for_review :boolean default(FALSE), not null
# received_at :datetime
# requested_at :datetime
# review_note :string default(""), not null
# review_passed :boolean
# reviewed_at :datetime
# verified_at :datetime
# verify_note :text default(""), not null
# verify_passed :boolean
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
# id :bigint not null, primary key
# expired_at :datetime
# location_note :text default(""), not null
# received_at :datetime
# requested_at :datetime
# review_note :string default(""), not null
# review_passed :boolean
# reviewed_at :datetime
# verified_at :datetime
# verify_note :text default(""), not null
# verify_passed :boolean
# created_at :datetime not null
# updated_at :datetime not null
# assessment_id :bigint not null
#
# Indexes
#
Expand Down
Loading