diff --git a/app/controllers/teacher_interface/base_controller.rb b/app/controllers/teacher_interface/base_controller.rb index 5a8956c5d6..fda443ac09 100644 --- a/app/controllers/teacher_interface/base_controller.rb +++ b/app/controllers/teacher_interface/base_controller.rb @@ -27,7 +27,7 @@ def document .assessment &.further_information_requests &.flat_map(&:items) || [] - ) + (application_form.assessment&.qualification_requests || []), + ) + (application_form.assessment&.consent_requests || []), ).find(params[:document_id] || params[:id]) end @@ -42,9 +42,8 @@ def redirect_unless_draft_or_additional_information unless document.documentable.further_information_request.requested? redirect_to %i[teacher_interface application_form] end - elsif document.for_qualification_request? - if document.documentable.consent_requested_at.nil? || - document.documentable.consent_received_at.present? + elsif document.for_consent_request? + if !document.documentable.requested? || document.documentable.received? redirect_to %i[teacher_interface application_form] end else diff --git a/app/controllers/teacher_interface/consent_requests_controller.rb b/app/controllers/teacher_interface/consent_requests_controller.rb new file mode 100644 index 0000000000..57c2959793 --- /dev/null +++ b/app/controllers/teacher_interface/consent_requests_controller.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +module TeacherInterface + class ConsentRequestsController < BaseController + include HandleApplicationFormSection + include HistoryTrackable + + before_action :load_consent_request, only: %i[edit_download update_download] + + define_history_check :check + define_history_origin :index + define_history_reset :index + + def index + @view_object = ConsentRequestsViewObject.new(application_form:) + end + + def check + @view_object = ConsentRequestsViewObject.new(application_form:) + end + + def submit + ActiveRecord::Base.transaction do + application_form.assessment.consent_requests.each do |requestable| + ReceiveRequestable.call(requestable:, user: current_teacher) + end + end + + TeacherMailer.with(application_form:).consent_submitted.deliver_later + + redirect_to %i[teacher_interface application_form] + end + + def edit_download + @form = + DownloadUnsignedConsentDocumentForm.new( + consent_request:, + downloaded: consent_request.unsigned_document_downloaded, + ) + end + + def update_download + @form = + DownloadUnsignedConsentDocumentForm.new( + consent_request:, + downloaded: + params.dig( + :teacher_interface_download_unsigned_consent_document_form, + :downloaded, + ), + ) + + handle_application_form_section( + form: @form, + if_success_then_redirect: + teacher_interface_application_form_consent_requests_path, + if_failure_then_render: :edit_download, + ) + end + + private + + attr_reader :consent_request + + def load_consent_request + @consent_request = + ConsentRequest + .joins(assessment: :application_form) + .includes(:qualification, :application_form) + .find_by!(id: params[:id], assessment: { application_form: }) + + @qualification = consent_request.qualification + end + end +end diff --git a/app/controllers/teacher_interface/qualification_requests_controller.rb b/app/controllers/teacher_interface/qualification_requests_controller.rb deleted file mode 100644 index e2d311e2cd..0000000000 --- a/app/controllers/teacher_interface/qualification_requests_controller.rb +++ /dev/null @@ -1,77 +0,0 @@ -# frozen_string_literal: true - -module TeacherInterface - class QualificationRequestsController < BaseController - include HandleApplicationFormSection - include HistoryTrackable - - before_action :load_qualification_request, - only: %i[edit_download update_download] - - define_history_origin :index - define_history_reset :index - - def index - @view_object = QualificationRequestsViewObject.new(application_form:) - end - - def check - @view_object = QualificationRequestsViewObject.new(application_form:) - end - - def submit - @qualification_requests ||= - application_form - .assessment - .qualification_requests - .consent_respondable - .update_all(consent_received_at: Time.zone.now) - - TeacherMailer.with(application_form:).consent_submitted.deliver_later - - redirect_to %i[teacher_interface application_form] - end - - def edit_download - @form = - QualificationRequestDownloadForm.new( - qualification_request:, - downloaded: - qualification_request.unsigned_consent_document_downloaded, - ) - end - - def update_download - @form = - QualificationRequestDownloadForm.new( - qualification_request:, - downloaded: - params.dig( - :teacher_interface_qualification_request_download_form, - :downloaded, - ), - ) - - handle_application_form_section( - form: @form, - if_success_then_redirect: - teacher_interface_application_form_qualification_requests_path, - if_failure_then_render: :edit_download, - ) - end - - private - - attr_reader :qualification_request - - def load_qualification_request - @qualification_request = - QualificationRequest - .joins(assessment: :application_form) - .includes(:qualification, :application_form) - .find_by!(id: params[:id], assessment: { application_form: }) - - @qualification = qualification_request.qualification - end - end -end diff --git a/app/forms/assessor_interface/upload_unsigned_consent_document_form.rb b/app/forms/assessor_interface/upload_unsigned_consent_document_form.rb index 87612b8e16..d8e01513ae 100644 --- a/app/forms/assessor_interface/upload_unsigned_consent_document_form.rb +++ b/app/forms/assessor_interface/upload_unsigned_consent_document_form.rb @@ -5,8 +5,8 @@ class AssessorInterface::UploadUnsignedConsentDocumentForm include ActiveModel::Attributes include UploadableForm - attr_accessor :qualification_request - validates :qualification_request, presence: true + attr_accessor :consent_request + validates :consent_request, presence: true def save return false if invalid? @@ -17,6 +17,6 @@ def save end def document - qualification_request&.unsigned_consent_document + consent_request&.unsigned_consent_document end end diff --git a/app/forms/teacher_interface/download_unsigned_consent_document_form.rb b/app/forms/teacher_interface/download_unsigned_consent_document_form.rb new file mode 100644 index 0000000000..ca4798bc8e --- /dev/null +++ b/app/forms/teacher_interface/download_unsigned_consent_document_form.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module TeacherInterface + class DownloadUnsignedConsentDocumentForm < BaseForm + attr_accessor :consent_request + attribute :downloaded, :boolean + + validates :consent_request, presence: true + validates :downloaded, presence: true + + def update_model + consent_request.update!(unsigned_document_downloaded: true) if downloaded + end + end +end diff --git a/app/forms/teacher_interface/qualification_request_download_form.rb b/app/forms/teacher_interface/qualification_request_download_form.rb deleted file mode 100644 index 656dc2b157..0000000000 --- a/app/forms/teacher_interface/qualification_request_download_form.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module TeacherInterface - class QualificationRequestDownloadForm < BaseForm - attr_accessor :qualification_request - attribute :downloaded, :boolean - - validates :qualification_request, presence: true - validates :downloaded, presence: true - - def update_model - if downloaded - qualification_request.update!( - unsigned_consent_document_downloaded: true, - ) - end - end - end -end diff --git a/app/lib/application_form_status_updater.rb b/app/lib/application_form_status_updater.rb index ab966585bd..c1a5964d78 100644 --- a/app/lib/application_form_status_updater.rb +++ b/app/lib/application_form_status_updater.rb @@ -172,7 +172,7 @@ def requestable_statuses end def overdue_consent - overdue?(requestables: qualification_requests.reject(&:requested?)) + overdue?(requestables: consent_requests) end def overdue_further_information @@ -193,12 +193,7 @@ def overdue_reference end def received_consent - qualification_requests - .reject(&:verified?) - .reject(&:reviewed?) - .reject(&:expired?) - .reject(&:requested?) - .any?(&:consent_received?) + received?(requestables: consent_requests) end def received_further_information @@ -239,12 +234,7 @@ def received_reference end def waiting_on_consent - qualification_requests - .reject(&:verified?) - .reject(&:reviewed?) - .reject(&:expired?) - .reject(&:consent_received?) - .any?(&:consent_requested?) + waiting_on?(requestables: consent_requests) end def waiting_on_further_information @@ -263,6 +253,10 @@ def waiting_on_reference waiting_on?(requestables: reference_requests) end + def consent_requests + @consent_requests ||= assessment&.consent_requests.to_a + end + def further_information_requests @further_information_requests ||= assessment&.further_information_requests.to_a diff --git a/app/lib/document_continue_redirection.rb b/app/lib/document_continue_redirection.rb index bd3287fdf6..459b735ae3 100644 --- a/app/lib/document_continue_redirection.rb +++ b/app/lib/document_continue_redirection.rb @@ -10,8 +10,8 @@ def initialize(document:) def call if document.for_further_information_request? further_information_request_url - elsif document.for_qualification_request? - qualification_request_url + elsif document.for_consent_request? + consent_request_url else send("#{document.document_type}_url") end @@ -68,7 +68,7 @@ def further_information_request_url ] end - def qualification_request_url - %i[teacher_interface application_form qualification_requests] + def consent_request_url + %i[teacher_interface application_form consent_requests] end end diff --git a/app/mailers/teacher_mailer.rb b/app/mailers/teacher_mailer.rb index 16129261da..f0040275f7 100644 --- a/app/mailers/teacher_mailer.rb +++ b/app/mailers/teacher_mailer.rb @@ -57,12 +57,7 @@ def application_received end def consent_reminder - @expires_at = - assessment - .qualification_requests - .consent_method_signed - .map(&:expires_at) - .max + @expires_at = assessment.consent_requests.map(&:expires_at).max view_mail( GOVUK_NOTIFY_TEMPLATE_ID, @@ -72,12 +67,7 @@ def consent_reminder end def consent_requested - @expires_at = - assessment - .qualification_requests - .consent_method_signed - .map(&:expires_at) - .max + @expires_at = assessment.consent_requests.map(&:expires_at).max view_mail( GOVUK_NOTIFY_TEMPLATE_ID, diff --git a/app/models/application_form.rb b/app/models/application_form.rb index c64a0cb994..86a1090838 100644 --- a/app/models/application_form.rb +++ b/app/models/application_form.rb @@ -256,8 +256,8 @@ def should_send_reminder_email?(name, number_of_reminders_sent) case name when "consent" number_of_reminders_sent.zero? && - consent_requests_not_yet_received.any? do |qualification_request| - qualification_request.days_until_expired <= 21 + consent_requests_not_yet_received_or_rejected.any? do |consent_request| + consent_request.days_until_expired <= 21 end when "expiration" return false if days_until_expired.nil? @@ -296,7 +296,7 @@ def send_reminder_email(name, number_of_reminders_sent) end end - def expires_from + def requested_at created_at end @@ -314,10 +314,11 @@ def reference_requests_not_yet_received_or_rejected .where(received_at: nil, verify_passed: nil, review_passed: nil) end - def consent_requests_not_yet_received - QualificationRequest + def consent_requests_not_yet_received_or_rejected + ConsentRequest .joins(:qualification) .where(qualifications: { application_form_id: id }) - .consent_respondable + .where.not(requested_at: nil) + .where(received_at: nil, verify_passed: nil) end end diff --git a/app/models/assessment.rb b/app/models/assessment.rb index d021178497..79e0161c1e 100644 --- a/app/models/assessment.rb +++ b/app/models/assessment.rb @@ -37,10 +37,12 @@ class Assessment < ApplicationRecord belongs_to :application_form has_many :sections, class_name: "AssessmentSection", dependent: :destroy + + has_many :consent_requests, dependent: :destroy has_many :further_information_requests, dependent: :destroy has_one :professional_standing_request, dependent: :destroy, required: false - has_many :reference_requests, dependent: :destroy has_many :qualification_requests, dependent: :destroy + has_many :reference_requests, dependent: :destroy enum :recommendation, { diff --git a/app/models/concerns/expirable.rb b/app/models/concerns/expirable.rb index 93ae7f4886..6b6fa64280 100644 --- a/app/models/concerns/expirable.rb +++ b/app/models/concerns/expirable.rb @@ -4,9 +4,9 @@ module Expirable extend ActiveSupport::Concern def expires_at - return nil if expires_from.nil? || expires_after.nil? + return nil if requested_at.nil? || expires_after.nil? - expires_from + expires_after + requested_at + expires_after end def days_until_expired diff --git a/app/models/concerns/requestable.rb b/app/models/concerns/requestable.rb index 75e7bc139a..0afab4020a 100644 --- a/app/models/concerns/requestable.rb +++ b/app/models/concerns/requestable.rb @@ -10,18 +10,14 @@ module Requestable scope :requested, -> { where.not(requested_at: nil) } scope :received, -> { where.not(received_at: nil) } + scope :not_received, -> { where(received_at: nil) } scope :respondable, - -> do - requested.where(received_at: nil).merge(ApplicationForm.assessable) - end + -> { requested.not_received.merge(ApplicationForm.assessable) } + scope :verified, -> { where.not(verified_at: nil) } has_one :application_form, through: :assessment end - def expires_from - requested_at || try(:consent_requested_at) - end - def requested! update!(requested_at: Time.zone.now) end @@ -62,7 +58,7 @@ def verify_failed? try(:verify_passed) == false end - def status + def status(not_requested: "not_started") if review_passed? || review_failed? review_status elsif verify_passed? @@ -78,7 +74,7 @@ def status elsif requested? "waiting_on" else - "not_started" + not_requested end end diff --git a/app/models/document.rb b/app/models/document.rb index d7ff699243..2c1230c3fc 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -68,16 +68,15 @@ def allow_multiple_uploads? end def optional? - (signed_consent? && !documentable.consent_method_signed?) || - (written_statement? && application_form.written_statement_optional) + written_statement? && application_form.written_statement_optional end def for_further_information_request? documentable.is_a?(FurtherInformationRequestItem) end - def for_qualification_request? - documentable.is_a?(QualificationRequest) + def for_consent_request? + documentable.is_a?(ConsentRequest) end def application_form diff --git a/app/models/timeline_event.rb b/app/models/timeline_event.rb index decfcee80b..0a46250669 100644 --- a/app/models/timeline_event.rb +++ b/app/models/timeline_event.rb @@ -131,6 +131,7 @@ class TimelineEvent < ApplicationRecord validates :requestable_type, presence: true, inclusion: %w[ + ConsentRequest FurtherInformationRequest ProfessionalStandingRequest QualificationRequest diff --git a/app/view_objects/assessor_interface/qualification_requests_view_object.rb b/app/view_objects/assessor_interface/qualification_requests_view_object.rb index 63ed1843ea..ee3a798c2d 100644 --- a/app/view_objects/assessor_interface/qualification_requests_view_object.rb +++ b/app/view_objects/assessor_interface/qualification_requests_view_object.rb @@ -38,6 +38,11 @@ def qualification_requests application_form.assessment.qualification_requests.order_by_role end + def consent_requests + @consent_requests ||= + application_form.assessment.consent_requests.order_by_role + end + def individual_task_items_for(qualification_request:) return [] if qualification_request.consent_method_unknown? @@ -106,8 +111,7 @@ def unsigned_consent_method_task_items(_qualification_request) end def send_consent_document_in_all_qualifications? - all_consent_methods_selected? && - qualification_requests.consent_method_signed.count >= 2 + all_consent_methods_selected? && consent_requests.count >= 2 end def send_consent_document_task_item @@ -115,14 +119,10 @@ def send_consent_document_task_item name: "Send consent document to applicant", link: "#", status: - if qualification_requests.map(&:unsigned_consent_document).all?( + if consent_requests.map(&:unsigned_consent_document).all?( &:completed? ) - if qualification_requests.all(&:consent_requested?) - "completed" - else - "not_started" - end + consent_requests.all?(&:requested?) ? "completed" : "not_started" else "cannot_start" end, @@ -130,13 +130,18 @@ def send_consent_document_task_item end def signed_consent_method_task_items(qualification_request) + consent_request = + consent_requests.find_by!( + qualification: qualification_request.qualification, + ) + [ { name: "Upload consent document", link: "#", status: ( - if qualification_request.unsigned_consent_document.completed? + if consent_request.unsigned_consent_document.completed? "completed" else "not_started" @@ -150,13 +155,8 @@ def signed_consent_method_task_items(qualification_request) name: "Record applicant response", link: "#", status: - if qualification_request.consent_received? - "completed" - elsif qualification_request.consent_requested? - "not_started" - else - "cannot_start" - end, + consent_request.status(not_requested: "cannot_start") || + "cannot_start", }, ] end @@ -166,7 +166,10 @@ def ecctis_task_items(qualification_request) ( qualification_request.consent_method_unsigned? && assessment.unsigned_consent_document_generated - ) || qualification_request.consent_received? + ) || + consent_requests.verified.exists?( + qualification: qualification_request.qualification, + ) [ { diff --git a/app/view_objects/teacher_interface/application_form_view_object.rb b/app/view_objects/teacher_interface/application_form_view_object.rb index 8ed849452f..5badcfd6f0 100644 --- a/app/view_objects/teacher_interface/application_form_view_object.rb +++ b/app/view_objects/teacher_interface/application_form_view_object.rb @@ -149,18 +149,13 @@ def request_professional_standing_certificate? def request_qualification_consent? return false if assessment.nil? - qualification_requests.consent_respondable.exists? + consent_requests.requested.not_received.exists? end def qualification_consent_submitted? - return false if assessment.nil? - - required_qualification_requests = - qualification_requests.consent_method_signed - - return false if required_qualification_requests.empty? + return false if assessment.nil? || consent_requests.empty? - required_qualification_requests.all?(&:consent_received?) + consent_requests.all?(&:received?) end def show_work_history_under_submission_banner? @@ -182,7 +177,8 @@ def show_work_history_under_induction_banner? :requires_preliminary_check, to: :application_form - delegate :professional_standing_request, + delegate :consent_requests, + :professional_standing_request, :qualification_requests, to: :assessment, allow_nil: true diff --git a/app/view_objects/teacher_interface/consent_requests_view_object.rb b/app/view_objects/teacher_interface/consent_requests_view_object.rb new file mode 100644 index 0000000000..eeef5942a4 --- /dev/null +++ b/app/view_objects/teacher_interface/consent_requests_view_object.rb @@ -0,0 +1,92 @@ +# frozen_string_literal: true + +module TeacherInterface + class ConsentRequestsViewObject + include QualificationHelper + + def initialize(application_form:) + @application_form = application_form + end + + def task_list_sections + consent_requests.map do |consent_request| + { + title: qualification_title(consent_request.qualification), + items: task_list_items(consent_request), + } + end + end + + def can_submit? + consent_requests.all? do |consent_request| + consent_request.unsigned_document_downloaded && + consent_request.signed_consent_document.completed? + end + end + + def check_your_answers_fields + consent_requests.each_with_object({}) do |consent_request, memo| + memo[consent_request.id] = { + title: qualification_title(consent_request.qualification), + value: consent_request.signed_consent_document, + href: [ + :teacher_interface, + :application_form, + consent_request.signed_consent_document, + ], + } + end + end + + private + + attr_reader :application_form + + def consent_requests + @consent_requests ||= + application_form.assessment.consent_requests.requested.order_by_user + end + + def task_list_items(consent_request) + institution_name = consent_request.qualification.institution_name + + [ + { + link: [ + :download, + :teacher_interface, + :application_form, + consent_request, + ], + name: "Download #{institution_name} consent document", + status: download_unsigned_consent_document_status(consent_request), + }, + { + link: [ + :teacher_interface, + :application_form, + consent_request.signed_consent_document, + ], + name: "Upload #{institution_name} consent document", + status: upload_signed_consent_document_status(consent_request), + }, + ] + end + + def download_unsigned_consent_document_status(consent_request) + consent_request.unsigned_document_downloaded ? :completed : :not_started + end + + def upload_signed_consent_document_status(consent_request) + if consent_request.unsigned_document_downloaded + if consent_request.signed_consent_document.completed? + :completed + else + :not_started + end + else + :cannot_start + end + end + end +end diff --git a/app/view_objects/teacher_interface/qualification_requests_view_object.rb b/app/view_objects/teacher_interface/qualification_requests_view_object.rb deleted file mode 100644 index c781843214..0000000000 --- a/app/view_objects/teacher_interface/qualification_requests_view_object.rb +++ /dev/null @@ -1,103 +0,0 @@ -# frozen_string_literal: true - -module TeacherInterface - class QualificationRequestsViewObject - include QualificationHelper - - def initialize(application_form:) - @application_form = application_form - end - - def task_list_sections - qualification_requests.map do |qualification_request| - { - title: qualification_title(qualification_request.qualification), - items: task_list_items(qualification_request), - } - end - end - - def can_submit? - qualification_requests.all? do |qualification_request| - qualification_request.unsigned_consent_document_downloaded && - qualification_request.signed_consent_document.completed? - end - end - - def check_your_answers_fields - qualification_requests.each_with_object( - {}, - ) do |qualification_request, memo| - memo[qualification_request.id] = { - title: qualification_title(qualification_request.qualification), - value: qualification_request.signed_consent_document, - href: [ - :teacher_interface, - :application_form, - qualification_request.signed_consent_document, - ], - } - end - end - - private - - attr_reader :application_form - - def qualification_requests - @qualification_requests ||= - application_form - .assessment - .qualification_requests - .order_by_user - .consent_respondable - end - - def task_list_items(qualification_request) - institution_name = qualification_request.qualification.institution_name - - [ - { - link: [ - :download, - :teacher_interface, - :application_form, - qualification_request, - ], - name: "Download #{institution_name} consent document", - status: - download_unsigned_consent_document_status(qualification_request), - }, - { - link: [ - :teacher_interface, - :application_form, - qualification_request.signed_consent_document, - ], - name: "Upload #{institution_name} consent document", - status: upload_signed_consent_document_status(qualification_request), - }, - ] - end - - def download_unsigned_consent_document_status(qualification_request) - if qualification_request.unsigned_consent_document_downloaded - :completed - else - :not_started - end - end - - def upload_signed_consent_document_status(qualification_request) - if qualification_request.unsigned_consent_document_downloaded - if qualification_request.signed_consent_document.completed? - :completed - else - :not_started - end - else - :cannot_start - end - end - end -end diff --git a/app/views/teacher_interface/application_forms/show/_request_qualification_consent.html.erb b/app/views/teacher_interface/application_forms/show/_request_qualification_consent.html.erb index 624207f747..7024f927d7 100644 --- a/app/views/teacher_interface/application_forms/show/_request_qualification_consent.html.erb +++ b/app/views/teacher_interface/application_forms/show/_request_qualification_consent.html.erb @@ -15,4 +15,4 @@
  • upload the signed document
  • -<%= govuk_start_button(text: "Start now", href: %i[teacher_interface application_form qualification_requests]) %> +<%= govuk_start_button(text: "Start now", href: %i[teacher_interface application_form consent_requests]) %> diff --git a/app/views/teacher_interface/qualification_requests/check.html.erb b/app/views/teacher_interface/consent_requests/check.html.erb similarity index 89% rename from app/views/teacher_interface/qualification_requests/check.html.erb rename to app/views/teacher_interface/consent_requests/check.html.erb index 2b28dc4865..9d16f447db 100644 --- a/app/views/teacher_interface/qualification_requests/check.html.erb +++ b/app/views/teacher_interface/consent_requests/check.html.erb @@ -1,5 +1,5 @@ <% content_for :page_title, "Check your uploaded consent documents" %> -<% content_for :back_link_url, back_history_path(default: teacher_interface_application_form_qualification_requests_path) %> +<% content_for :back_link_url, back_history_path(default: teacher_interface_application_form_consent_requests_path) %>

    Check your uploaded consent documents

    @@ -14,5 +14,5 @@

    Submit your consent documents

    By selecting the ‘Submit’ button you confirm that, to the best of your knowledge, the details you’ve provided are correct.

    You will not be able to change your response, add new documents, or delete anything once you submit.

    - <%= govuk_button_to "Submit", submit_teacher_interface_application_form_qualification_requests_path %> + <%= govuk_button_to "Submit", submit_teacher_interface_application_form_consent_requests_path %> <% end %> diff --git a/app/views/teacher_interface/qualification_requests/edit_download.html.erb b/app/views/teacher_interface/consent_requests/edit_download.html.erb similarity index 80% rename from app/views/teacher_interface/qualification_requests/edit_download.html.erb rename to app/views/teacher_interface/consent_requests/edit_download.html.erb index b059fc3aed..87dda315c2 100644 --- a/app/views/teacher_interface/qualification_requests/edit_download.html.erb +++ b/app/views/teacher_interface/consent_requests/edit_download.html.erb @@ -1,7 +1,7 @@ <% content_for :page_title, "Download consent document" %> -<% content_for :back_link_url, back_history_path(default: teacher_interface_application_form_qualification_requests_path) %> +<% content_for :back_link_url, back_history_path(default: teacher_interface_application_form_consent_requests_path) %> -<%= form_with model: @form, url: [:download, :teacher_interface, :application_form, @qualification_request] do |f| %> +<%= form_with model: @form, url: [:download, :teacher_interface, :application_form, @consent_request] do |f| %> <%= f.govuk_error_summary %>

    Download consent document

    @@ -11,7 +11,7 @@

    Download the consent document

    -

    <%= document_link_to(@qualification_request.unsigned_consent_document) %>

    +

    <%= document_link_to(@consent_request.unsigned_consent_document) %>

    diff --git a/app/views/teacher_interface/qualification_requests/index.html.erb b/app/views/teacher_interface/consent_requests/index.html.erb similarity index 92% rename from app/views/teacher_interface/qualification_requests/index.html.erb rename to app/views/teacher_interface/consent_requests/index.html.erb index 96cc62cd37..ea06d5a73e 100644 --- a/app/views/teacher_interface/qualification_requests/index.html.erb +++ b/app/views/teacher_interface/consent_requests/index.html.erb @@ -7,7 +7,7 @@
    <% if @view_object.can_submit? %> - <%= govuk_button_link_to "Continue", check_teacher_interface_application_form_qualification_requests_path %> + <%= govuk_button_link_to "Continue", check_teacher_interface_application_form_consent_requests_path %> <% end %> <%= govuk_button_link_to t("teacher_interface.application_forms.show.draft.save"), destroy_teacher_session_path, secondary: true %> diff --git a/config/locales/components.en.yml b/config/locales/components.en.yml index 2ddb621875..40925f8167 100644 --- a/config/locales/components.en.yml +++ b/config/locales/components.en.yml @@ -63,26 +63,31 @@ en: note_created: Note created reviewer_assigned: Reviewer assigned requestable_requested: + ConsentRequest: Consent requested FurtherInformationRequest: Further information requested ProfessionalStandingRequest: Professional standing requested QualificationRequest: Qualification requested ReferenceRequest: Reference requested requestable_received: + ConsentRequest: Consent received FurtherInformationRequest: Further information received ProfessionalStandingRequest: Professional standing received QualificationRequest: Qualification received ReferenceRequest: Reference received requestable_expired: + ConsentRequest: Consent expired FurtherInformationRequest: Further information expired ProfessionalStandingRequest: Professional standing expired QualificationRequest: Qualification expired ReferenceRequest: Reference expired requestable_reviewed: + ConsentRequest: Consent reviewed FurtherInformationRequest: Further information assessed ProfessionalStandingRequest: Professional standing reviewed QualificationRequest: Qualification reviewed ReferenceRequest: Reference reviewed requestable_verified: + ConsentRequest: Consent verified FurtherInformationRequest: Further information verified ProfessionalStandingRequest: Professional standing verified QualificationRequest: Qualification verified @@ -96,16 +101,19 @@ en: note_created: "%{text}" reviewer_assigned: "%{assignee_name} is assigned as the reviewer." requestable_requested: + ConsentRequest: Consent has been requested. FurtherInformationRequest: Further information has been requested. ProfessionalStandingRequest: The professional standing has been requested. QualificationRequest: A qualification has been requested. ReferenceRequest: A reference has been requested. requestable_received: + ConsentRequest: A consent request has been received. FurtherInformationRequest: Further information requested on %{requested_at} has been received. ProfessionalStandingRequest: "The professional standing has been received: %{location_note}" QualificationRequest: A qualification has been received. ReferenceRequest: A reference has been received. requestable_expired: + ConsentRequest: A consent request has expired. FurtherInformationRequest: Further information requested on %{requested_at} has expired. Application has been declined. ProfessionalStandingRequest: The professional standing request has expired. QualificationRequest: A qualification request has expired. diff --git a/config/locales/teacher_interface.en.yml b/config/locales/teacher_interface.en.yml index a562ccaa5d..8a3c6d3f5f 100644 --- a/config/locales/teacher_interface.en.yml +++ b/config/locales/teacher_interface.en.yml @@ -300,7 +300,7 @@ en: invalid: Enter the certificate date in the format 27 3 1980 future: Certificate date must be in the past comparison: Certificate date must be after completion date - teacher_interface/qualification_request_download_form: + teacher_interface/download_unsigned_consent_document_form: attributes: downloaded: blank: Confirm that you have downloaded the consent document. diff --git a/config/routes.rb b/config/routes.rb index 8ed78b5f95..b4397b8042 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -348,12 +348,10 @@ only: %i[edit update] end - resources :qualification_requests, - path: "/qualification-requests", - only: %i[index] do + resources :consent_requests, path: "/consent-requests", only: %i[index] do member do - get "download", to: "qualification_requests#edit_download" - post "download", to: "qualification_requests#update_download" + get "download", to: "consent_requests#edit_download" + post "download", to: "consent_requests#update_download" end collection do diff --git a/lib/tasks/example_data.rake b/lib/tasks/example_data.rake index bd8357fc0f..7e8dad358c 100644 --- a/lib/tasks/example_data.rake +++ b/lib/tasks/example_data.rake @@ -182,10 +182,14 @@ def create_requestables(application_form, assessment, state) qualifications.each do |qualification| FactoryBot.create( :qualification_request, - [state, "consent_#{state}"].sample, + state, assessment:, qualification:, ) + + next unless rand(2).zero? + + FactoryBot.create(:consent_request, state, assessment:, qualification:) end assessment.verify! diff --git a/spec/factories/assessments.rb b/spec/factories/assessments.rb index ac4c00d259..1f4d07748f 100644 --- a/spec/factories/assessments.rb +++ b/spec/factories/assessments.rb @@ -74,6 +74,16 @@ end end + trait :with_consent_request do + after(:create) do |assessment, _evaluator| + create( + :consent_request, + assessment:, + qualification: assessment.application_form.qualifications.first, + ) + end + end + trait :with_further_information_request do after(:create) do |assessment, _evaluator| create( diff --git a/spec/forms/assessor_interface/upload_unsigned_consent_document_form_spec.rb b/spec/forms/assessor_interface/upload_unsigned_consent_document_form_spec.rb index 62d66d72b6..5fab3b0f64 100644 --- a/spec/forms/assessor_interface/upload_unsigned_consent_document_form_spec.rb +++ b/spec/forms/assessor_interface/upload_unsigned_consent_document_form_spec.rb @@ -4,15 +4,13 @@ RSpec.describe AssessorInterface::UploadUnsignedConsentDocumentForm, type: :model do - subject(:form) do - described_class.new(qualification_request:, original_attachment:) - end + subject(:form) { described_class.new(consent_request:, original_attachment:) } - let(:qualification_request) { create(:qualification_request) } - let(:document) { qualification_request.unsigned_consent_document } + let(:consent_request) { create(:consent_request) } + let(:document) { consent_request.unsigned_consent_document } let(:original_attachment) { nil } - it { is_expected.to validate_presence_of(:qualification_request) } + it { is_expected.to validate_presence_of(:consent_request) } describe "validations" do it { is_expected.to validate_absence_of(:written_in_english) } diff --git a/spec/forms/teacher_interface/qualification_request_download_form_spec.rb b/spec/forms/teacher_interface/download_unsigned_consent_document_form_spec.rb similarity index 51% rename from spec/forms/teacher_interface/qualification_request_download_form_spec.rb rename to spec/forms/teacher_interface/download_unsigned_consent_document_form_spec.rb index 7158cd8b21..cc2c18f712 100644 --- a/spec/forms/teacher_interface/qualification_request_download_form_spec.rb +++ b/spec/forms/teacher_interface/download_unsigned_consent_document_form_spec.rb @@ -2,16 +2,16 @@ require "rails_helper" -RSpec.describe TeacherInterface::QualificationRequestDownloadForm, +RSpec.describe TeacherInterface::DownloadUnsignedConsentDocumentForm, type: :model do - let(:qualification_request) { create(:qualification_request) } + let(:consent_request) { create(:consent_request) } - subject(:form) { described_class.new(qualification_request:, downloaded:) } + subject(:form) { described_class.new(consent_request:, downloaded:) } describe "validations" do let(:downloaded) { "" } - it { is_expected.to validate_presence_of(:qualification_request) } + it { is_expected.to validate_presence_of(:consent_request) } it { is_expected.to validate_presence_of(:downloaded) } end @@ -21,10 +21,10 @@ context "with a positive response" do let(:downloaded) { "true" } - it "sets unsigned_consent_document_downloaded" do + it "sets unsigned_document_downloaded" do expect { save }.to change( - qualification_request, - :unsigned_consent_document_downloaded, + consent_request, + :unsigned_document_downloaded, ).to(true) end end @@ -32,10 +32,10 @@ context "with a negative response" do let(:downloaded) { "false" } - it "doesn't set unsigned_consent_document_downloaded" do + it "doesn't set unsigned_document_downloaded" do expect { save }.to_not change( - qualification_request, - :unsigned_consent_document_downloaded, + consent_request, + :unsigned_document_downloaded, ) end end diff --git a/spec/lib/document_continue_redirection_spec.rb b/spec/lib/document_continue_redirection_spec.rb index 876e7bbf37..fafb8e1640 100644 --- a/spec/lib/document_continue_redirection_spec.rb +++ b/spec/lib/document_continue_redirection_spec.rb @@ -128,31 +128,23 @@ end context "with an signed consent document" do - let(:qualification_request) { create(:qualification_request) } - let(:document) do - create(:document, :signed_consent, documentable: qualification_request) - end + let(:documentable) { create(:consent_request) } + let(:document) { create(:document, :signed_consent, documentable:) } it do is_expected.to eq( - %i[teacher_interface application_form qualification_requests], + %i[teacher_interface application_form consent_requests], ) end end context "with an unsigned consent document" do - let(:qualification_request) { create(:qualification_request) } - let(:document) do - create( - :document, - :unsigned_consent, - documentable: qualification_request, - ) - end + let(:documentable) { create(:consent_request) } + let(:document) { create(:document, :unsigned_consent, documentable:) } it do is_expected.to eq( - %i[teacher_interface application_form qualification_requests], + %i[teacher_interface application_form consent_requests], ) end end diff --git a/spec/mailers/teacher_mailer_spec.rb b/spec/mailers/teacher_mailer_spec.rb index f4a8856d0c..9115228fbf 100644 --- a/spec/mailers/teacher_mailer_spec.rb +++ b/spec/mailers/teacher_mailer_spec.rb @@ -263,10 +263,10 @@ before do create( - :qualification_request, - :consent_requested, + :consent_request, + :requested, assessment:, - consent_requested_at: Date.new(2020, 1, 1), + requested_at: Date.new(2020, 1, 1), qualification:, ) end @@ -309,10 +309,9 @@ before do create( - :qualification_request, - :consent_requested, + :consent_request, assessment:, - consent_requested_at: Date.new(2020, 1, 1), + requested_at: Date.new(2020, 1, 1), qualification:, ) end diff --git a/spec/models/application_form_spec.rb b/spec/models/application_form_spec.rb index 39a8269d07..cbb35c2e66 100644 --- a/spec/models/application_form_spec.rb +++ b/spec/models/application_form_spec.rb @@ -429,26 +429,26 @@ let(:number_of_reminders_sent) { 0 } it { is_expected.to be false } - context "with a qualification request" do + context "with a consent request" do before do create( - :qualification_request, + :consent_request, assessment:, qualification:, - consent_requested_at: 1.week.ago, + requested_at: 1.week.ago, ) end it { is_expected.to be false } end - context "with a qualification request older than 3 weeks ago" do + context "with a consent request older than 3 weeks ago" do before do create( - :qualification_request, + :consent_request, assessment:, qualification:, - consent_requested_at: 4.weeks.ago, + requested_at: 4.weeks.ago, ) end diff --git a/spec/services/destroy_application_form_spec.rb b/spec/services/destroy_application_form_spec.rb index 9d1161e8c1..7642bf144b 100644 --- a/spec/services/destroy_application_form_spec.rb +++ b/spec/services/destroy_application_form_spec.rb @@ -16,10 +16,11 @@ assessment = create( :assessment, + :with_consent_request, :with_further_information_request, :with_professional_standing_request, - :with_reference_request, :with_qualification_request, + :with_reference_request, application_form:, ) @@ -43,6 +44,7 @@ include_examples "deletes model", ApplicationForm include_examples "deletes model", Assessment include_examples "deletes model", AssessmentSection + include_examples "deletes model", ConsentRequest include_examples "deletes model", DQTTRNRequest include_examples "deletes model", Document, 20, 10 include_examples "deletes model", FurtherInformationRequest diff --git a/spec/support/autoload/page_objects/teacher_interface/check_qualification_requests.rb b/spec/support/autoload/page_objects/teacher_interface/check_consent_requests.rb similarity index 66% rename from spec/support/autoload/page_objects/teacher_interface/check_qualification_requests.rb rename to spec/support/autoload/page_objects/teacher_interface/check_consent_requests.rb index a390584cb7..9a2d654712 100644 --- a/spec/support/autoload/page_objects/teacher_interface/check_qualification_requests.rb +++ b/spec/support/autoload/page_objects/teacher_interface/check_consent_requests.rb @@ -2,8 +2,8 @@ module PageObjects module TeacherInterface - class CheckQualificationRequests < SitePrism::Page - set_url "/teacher/application/qualification-requests/check" + class CheckConsentRequests < SitePrism::Page + set_url "/teacher/application/consent-requests/check" element :heading, "h1" section :summary_card, GovukSummaryCard, ".govuk-summary-card" diff --git a/spec/support/autoload/page_objects/teacher_interface/qualification_requests.rb b/spec/support/autoload/page_objects/teacher_interface/consent_requests.rb similarity index 75% rename from spec/support/autoload/page_objects/teacher_interface/qualification_requests.rb rename to spec/support/autoload/page_objects/teacher_interface/consent_requests.rb index 53db529dbe..2afb6f9187 100644 --- a/spec/support/autoload/page_objects/teacher_interface/qualification_requests.rb +++ b/spec/support/autoload/page_objects/teacher_interface/consent_requests.rb @@ -2,8 +2,8 @@ module PageObjects module TeacherInterface - class QualificationRequests < SitePrism::Page - set_url "/teacher/application/qualification-requests" + class ConsentRequests < SitePrism::Page + set_url "/teacher/application/consent-requests" section :task_list, TaskList, ".app-task-list" diff --git a/spec/support/autoload/page_objects/teacher_interface/qualification_request_download.rb b/spec/support/autoload/page_objects/teacher_interface/download_consent_request.rb similarity index 71% rename from spec/support/autoload/page_objects/teacher_interface/qualification_request_download.rb rename to spec/support/autoload/page_objects/teacher_interface/download_consent_request.rb index 3ae1638c18..4385a8f679 100644 --- a/spec/support/autoload/page_objects/teacher_interface/qualification_request_download.rb +++ b/spec/support/autoload/page_objects/teacher_interface/download_consent_request.rb @@ -2,8 +2,8 @@ module PageObjects module TeacherInterface - class QualificationRequestDownload < SitePrism::Page - set_url "/teacher/application/qualification-requests/{id}/download" + class DownloadConsentRequest < SitePrism::Page + set_url "/teacher/application/consent-requests/{id}/download" element :downloaded_checkbox, ".govuk-checkboxes__input", visible: false diff --git a/spec/support/page_helpers.rb b/spec/support/page_helpers.rb index fad7dd1bbc..f4c6e201db 100644 --- a/spec/support/page_helpers.rb +++ b/spec/support/page_helpers.rb @@ -346,6 +346,11 @@ def teacher_application_page @teacher_application_page = PageObjects::TeacherInterface::Application.new end + def teacher_check_consent_requests_page + @teacher_check_consent_requests_page = + PageObjects::TeacherInterface::CheckConsentRequests.new + end + def teacher_check_document_page @teacher_check_document_page = PageObjects::TeacherInterface::CheckDocument.new @@ -375,11 +380,6 @@ def teacher_check_qualification_page PageObjects::TeacherInterface::CheckQualification.new end - def teacher_check_qualification_requests_page - @teacher_check_qualification_requests_page = - PageObjects::TeacherInterface::CheckQualificationRequests.new - end - def teacher_check_qualifications_page @teacher_check_qualifications_page ||= PageObjects::TeacherInterface::CheckQualifications.new @@ -415,6 +415,11 @@ def teacher_check_your_uploads_page PageObjects::TeacherInterface::CheckYourUploads.new end + def teacher_consent_requests_page + @teacher_consent_requests_page = + PageObjects::TeacherInterface::ConsentRequests.new + end + def teacher_declined_application_page @teacher_declined_application_page ||= PageObjects::TeacherInterface::DeclinedApplication.new @@ -435,6 +440,11 @@ def teacher_document_available_page PageObjects::TeacherInterface::DocumentAvailable.new end + def teacher_download_consent_request_page + @teacher_download_consent_request_page = + PageObjects::TeacherInterface::DownloadConsentRequest.new + end + def teacher_edit_qualification_page @teacher_edit_qualification_page ||= PageObjects::TeacherInterface::EditQualification.new @@ -569,16 +579,6 @@ def teacher_personal_information_summary_page PageObjects::TeacherInterface::PersonalInformationSummary.new end - def teacher_qualification_requests_page - @teacher_qualification_requests_page = - PageObjects::TeacherInterface::QualificationRequests.new - end - - def teacher_qualification_request_download_page - @teacher_qualification_request_download_page = - PageObjects::TeacherInterface::QualificationRequestDownload.new - end - def teacher_reference_received_page @teacher_reference_received_page ||= PageObjects::TeacherInterface::ReferenceReceived.new diff --git a/spec/system/teacher_interface/qualification_consent_spec.rb b/spec/system/teacher_interface/consent_spec.rb similarity index 69% rename from spec/system/teacher_interface/qualification_consent_spec.rb rename to spec/system/teacher_interface/consent_spec.rb index f1e106f43b..e1fed8cae3 100644 --- a/spec/system/teacher_interface/qualification_consent_spec.rb +++ b/spec/system/teacher_interface/consent_spec.rb @@ -1,11 +1,11 @@ require "rails_helper" -RSpec.describe "Teacher qualification consent", type: :system do +RSpec.describe "Teacher consent", type: :system do before do given_the_service_is_open given_i_am_authorized_as_a_user(teacher) given_there_is_an_application_form - given_there_is_a_qualification_request + given_there_is_a_consent_request end it "save and sign out" do @@ -14,7 +14,7 @@ and_i_see_qualification_consent_start_now_content when_i_click_the_start_button - then_i_see_the(:teacher_qualification_requests_page) + then_i_see_the(:teacher_consent_requests_page) when_i_click_the_save_and_sign_out_button then_i_see_the(:teacher_signed_out_page) @@ -27,17 +27,17 @@ and_i_see_qualification_consent_start_now_content when_i_click_the_start_button - then_i_see_the(:teacher_qualification_requests_page) + then_i_see_the(:teacher_consent_requests_page) and_i_see_the_download_and_upload_tasks when_i_click_the_download_task then_i_see_the( - :teacher_qualification_request_download_page, - id: qualification_request.id, + :teacher_download_consent_request_page, + id: consent_request.id, ) when_i_check_the_downloaded_checkbox - then_i_see_the(:teacher_qualification_requests_page) + then_i_see_the(:teacher_consent_requests_page) when_i_click_the_upload_task then_i_see_the(:teacher_upload_document_page) @@ -46,10 +46,10 @@ then_i_see_the(:teacher_check_document_page) when_i_dont_need_to_upload_another_file - then_i_see_the(:teacher_qualification_requests_page) + then_i_see_the(:teacher_consent_requests_page) when_i_click_check_your_answers - then_i_see_the(:teacher_check_qualification_requests_page) + then_i_see_the(:teacher_check_consent_requests_page) and_i_see_the_documents when_i_click_submit @@ -61,8 +61,8 @@ def given_there_is_an_application_form application_form end - def given_there_is_a_qualification_request - qualification_request + def given_there_is_a_consent_request + consent_request end def and_i_see_qualification_consent_start_now_content @@ -76,7 +76,7 @@ def when_i_click_the_start_button end def when_i_click_the_save_and_sign_out_button - teacher_qualification_requests_page.save_and_sign_out_button.click + teacher_consent_requests_page.save_and_sign_out_button.click end def and_i_see_qualification_consent_sign_out_content @@ -86,7 +86,7 @@ def and_i_see_qualification_consent_sign_out_content end def and_i_see_the_download_and_upload_tasks - task_list = teacher_qualification_requests_page.task_list + task_list = teacher_consent_requests_page.task_list expect(task_list.sections.count).to eq(1) task_list_section = task_list.sections.first @@ -94,28 +94,16 @@ def and_i_see_the_download_and_upload_tasks end def when_i_click_the_download_task - teacher_qualification_requests_page - .task_list - .sections - .first - .items - .first - .click + teacher_consent_requests_page.task_list.sections.first.items.first.click end def when_i_check_the_downloaded_checkbox - teacher_qualification_request_download_page.downloaded_checkbox.check - teacher_qualification_request_download_page.continue_button.click + teacher_download_consent_request_page.downloaded_checkbox.check + teacher_download_consent_request_page.continue_button.click end def when_i_click_the_upload_task - teacher_qualification_requests_page - .task_list - .sections - .first - .items - .second - .click + teacher_consent_requests_page.task_list.sections.first.items.second.click end def when_i_upload_a_file @@ -130,15 +118,15 @@ def when_i_dont_need_to_upload_another_file end def when_i_click_check_your_answers - teacher_qualification_requests_page.check_your_answers_button.click + teacher_consent_requests_page.check_your_answers_button.click end def and_i_see_the_documents - expect(teacher_check_qualification_requests_page.summary_card).to be_visible + expect(teacher_check_consent_requests_page.summary_card).to be_visible end def when_i_click_submit - teacher_check_qualification_requests_page.submit_button.click + teacher_check_consent_requests_page.submit_button.click end def and_i_see_the_consent_submitted_status @@ -161,17 +149,18 @@ def application_form :submitted, :with_assessment, :with_teaching_qualification, - statuses: %w[waiting_on_qualification], + statuses: %w[waiting_on_consent], teacher:, ) end - def qualification_request - @qualification_request ||= + def consent_request + @consent_request ||= create( - :qualification_request, - :consent_requested, + :consent_request, + :requested, assessment: application_form.assessment, + qualification: application_form.qualifications.first, ) end end diff --git a/spec/view_objects/assessor_interface/qualification_requests_view_object_spec.rb b/spec/view_objects/assessor_interface/qualification_requests_view_object_spec.rb index 615237b38c..86bda626c1 100644 --- a/spec/view_objects/assessor_interface/qualification_requests_view_object_spec.rb +++ b/spec/view_objects/assessor_interface/qualification_requests_view_object_spec.rb @@ -15,13 +15,10 @@ end let(:assessment) { application_form.assessment } + let(:qualification) { application_form.qualifications.first } let!(:qualification_request) do - create( - :qualification_request, - assessment:, - qualification: application_form.qualifications.first, - ) + create(:qualification_request, assessment:, qualification:) end describe "#all_task_items" do @@ -139,7 +136,10 @@ end context "when signed consent method" do - before { qualification_request.consent_method_signed_ecctis! } + before do + qualification_request.consent_method_signed_ecctis! + create(:consent_request, assessment:, qualification:) + end it do is_expected.to eq( diff --git a/spec/view_objects/teacher_interface/qualification_requests_view_object_spec.rb b/spec/view_objects/teacher_interface/consent_requests_view_object_spec.rb similarity index 80% rename from spec/view_objects/teacher_interface/qualification_requests_view_object_spec.rb rename to spec/view_objects/teacher_interface/consent_requests_view_object_spec.rb index 8b3a0e8882..18eefa64fe 100644 --- a/spec/view_objects/teacher_interface/qualification_requests_view_object_spec.rb +++ b/spec/view_objects/teacher_interface/consent_requests_view_object_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -RSpec.describe TeacherInterface::QualificationRequestsViewObject do +RSpec.describe TeacherInterface::ConsentRequestsViewObject do subject(:view_object) { described_class.new(application_form:) } let(:application_form) do @@ -14,11 +14,11 @@ it { is_expected.to be_empty } - context "with a qualification request" do - let!(:qualification_request) do + context "with a consent request" do + let!(:consent_request) do create( - :qualification_request, - :consent_requested, + :consent_request, + :requested, assessment: application_form.assessment, qualification: create( @@ -42,7 +42,7 @@ :download, :teacher_interface, :application_form, - qualification_request, + consent_request, ], status: :not_started, }, @@ -51,7 +51,7 @@ link: [ :teacher_interface, :application_form, - qualification_request.signed_consent_document, + consent_request.signed_consent_document, ], status: :cannot_start, }, @@ -62,11 +62,7 @@ end context "when the unsigned consent document is downloaded" do - before do - qualification_request.update!( - unsigned_consent_document_downloaded: true, - ) - end + before { consent_request.update!(unsigned_document_downloaded: true) } it do is_expected.to eq( @@ -80,7 +76,7 @@ :download, :teacher_interface, :application_form, - qualification_request, + consent_request, ], status: :completed, }, @@ -89,7 +85,7 @@ link: [ :teacher_interface, :application_form, - qualification_request.signed_consent_document, + consent_request.signed_consent_document, ], status: :not_started, }, @@ -101,9 +97,7 @@ context "when the signed consent document is uploaded" do before do - qualification_request.signed_consent_document.update!( - completed: true, - ) + consent_request.signed_consent_document.update!(completed: true) end it do @@ -118,7 +112,7 @@ :download, :teacher_interface, :application_form, - qualification_request, + consent_request, ], status: :completed, }, @@ -127,7 +121,7 @@ link: [ :teacher_interface, :application_form, - qualification_request.signed_consent_document, + consent_request.signed_consent_document, ], status: :completed, },