From c99dc06f9c9e896786395baf6e20336c2b247c3d Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Fri, 16 Feb 2024 12:50:27 +0100 Subject: [PATCH] Move unsigned_consent_document_generated This moves the column to the assessment model as the unsigned consent document only has be generated once, not per qualification. --- app/models/assessment.rb | 1 + app/models/qualification_request.rb | 1 - config/analytics.yml | 2 +- ..._consent_document_generated_to_assessment.rb | 17 +++++++++++++++++ db/schema.rb | 4 ++-- spec/factories/assessments.rb | 1 + spec/factories/qualification_requests.rb | 1 - spec/models/assessment_spec.rb | 1 + spec/models/qualification_request_spec.rb | 1 - 9 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20240216114800_add_unsigned_consent_document_generated_to_assessment.rb diff --git a/app/models/assessment.rb b/app/models/assessment.rb index 29a535b893..444e2456e0 100644 --- a/app/models/assessment.rb +++ b/app/models/assessment.rb @@ -15,6 +15,7 @@ # started_at :datetime # subjects :text default([]), not null, is an Array # subjects_note :text default(""), not null +# unsigned_consent_document_generated :boolean default(FALSE), not null # working_days_since_started :integer # working_days_started_to_recommendation :integer # working_days_submission_to_recommendation :integer diff --git a/app/models/qualification_request.rb b/app/models/qualification_request.rb index 67b430ac62..5de3d25f54 100644 --- a/app/models/qualification_request.rb +++ b/app/models/qualification_request.rb @@ -16,7 +16,6 @@ # review_passed :boolean # reviewed_at :datetime # unsigned_consent_document_downloaded :boolean default(FALSE), not null -# unsigned_consent_document_generated :boolean default(FALSE), not null # verified_at :datetime # verify_note :text default(""), not null # verify_passed :boolean diff --git a/config/analytics.yml b/config/analytics.yml index f21c810dd9..a5b1a7ba2e 100644 --- a/config/analytics.yml +++ b/config/analytics.yml @@ -80,6 +80,7 @@ - started_at - subjects - subjects_note + - unsigned_consent_document_generated - updated_at - working_days_since_started - working_days_started_to_recommendation @@ -222,7 +223,6 @@ - review_passed - reviewed_at - unsigned_consent_document_downloaded - - unsigned_consent_document_generated - updated_at - verified_at - verify_note diff --git a/db/migrate/20240216114800_add_unsigned_consent_document_generated_to_assessment.rb b/db/migrate/20240216114800_add_unsigned_consent_document_generated_to_assessment.rb new file mode 100644 index 0000000000..4571dbfaef --- /dev/null +++ b/db/migrate/20240216114800_add_unsigned_consent_document_generated_to_assessment.rb @@ -0,0 +1,17 @@ +class AddUnsignedConsentDocumentGeneratedToAssessment < ActiveRecord::Migration[ + 7.1 +] + def change + add_column :assessments, + :unsigned_consent_document_generated, + :boolean, + default: false, + null: false + + remove_column :qualification_requests, + :unsigned_consent_document_generated, + :boolean, + default: false, + null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 5360cc282c..baab9f39f4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_02_15_092915) do +ActiveRecord::Schema[7.1].define(version: 2024_02_16_114800) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -141,6 +141,7 @@ t.text "recommendation_assessor_note", default: "", null: false t.boolean "references_verified" t.boolean "scotland_full_registration" + t.boolean "unsigned_consent_document_generated", default: false, null: false t.index ["application_form_id"], name: "index_assessments_on_application_form_id" end @@ -293,7 +294,6 @@ t.datetime "consent_received_at" t.datetime "consent_requested_at" t.string "consent_method", default: "unknown", null: false - t.boolean "unsigned_consent_document_generated", default: false, null: false t.index ["assessment_id"], name: "index_qualification_requests_on_assessment_id" t.index ["qualification_id"], name: "index_qualification_requests_on_qualification_id" end diff --git a/spec/factories/assessments.rb b/spec/factories/assessments.rb index 60a41c0b34..1d33856ab5 100644 --- a/spec/factories/assessments.rb +++ b/spec/factories/assessments.rb @@ -15,6 +15,7 @@ # started_at :datetime # subjects :text default([]), not null, is an Array # subjects_note :text default(""), not null +# unsigned_consent_document_generated :boolean default(FALSE), not null # working_days_since_started :integer # working_days_started_to_recommendation :integer # working_days_submission_to_recommendation :integer diff --git a/spec/factories/qualification_requests.rb b/spec/factories/qualification_requests.rb index 2a5dc8a9fe..067f2b5d2b 100644 --- a/spec/factories/qualification_requests.rb +++ b/spec/factories/qualification_requests.rb @@ -16,7 +16,6 @@ # review_passed :boolean # reviewed_at :datetime # unsigned_consent_document_downloaded :boolean default(FALSE), not null -# unsigned_consent_document_generated :boolean default(FALSE), not null # verified_at :datetime # verify_note :text default(""), not null # verify_passed :boolean diff --git a/spec/models/assessment_spec.rb b/spec/models/assessment_spec.rb index f198361805..4f6e9836ca 100644 --- a/spec/models/assessment_spec.rb +++ b/spec/models/assessment_spec.rb @@ -17,6 +17,7 @@ # started_at :datetime # subjects :text default([]), not null, is an Array # subjects_note :text default(""), not null +# unsigned_consent_document_generated :boolean default(FALSE), not null # working_days_since_started :integer # working_days_started_to_recommendation :integer # working_days_submission_to_recommendation :integer diff --git a/spec/models/qualification_request_spec.rb b/spec/models/qualification_request_spec.rb index 724236f152..e99ae97e22 100644 --- a/spec/models/qualification_request_spec.rb +++ b/spec/models/qualification_request_spec.rb @@ -16,7 +16,6 @@ # review_passed :boolean # reviewed_at :datetime # unsigned_consent_document_downloaded :boolean default(FALSE), not null -# unsigned_consent_document_generated :boolean default(FALSE), not null # verified_at :datetime # verify_note :text default(""), not null # verify_passed :boolean