Skip to content

Commit

Permalink
Add update_teaching_qualification_certificate_date task
Browse files Browse the repository at this point in the history
This adds a new Rake task that makes it possible to change the
certificate date of a qualification using the service added in the
previous commit.
  • Loading branch information
thomasleese committed Apr 25, 2024
1 parent 983ed86 commit 04aac7f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/tasks/application_forms.rake
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,26 @@ namespace :application_forms do
user:,
)
end

desc "Change the certificate date of a qualification for an application form."
task :update_teaching_qualification_certificate_date,
%i[reference staff_email certificate_date] =>
:environment do |_task, args|
application_form = ApplicationForm.find_by!(reference: args[:reference])
qualification = application_form.teaching_qualification
user = Staff.find_by!(email: args[:staff_email])
certificate_date = Date.parse(args[:certificate_date])

UpdateQualificationCertificateDate.call(
qualification:,
user:,
certificate_date:,
)

note =
"Amended date to accurately reflect the qualification (deemed by the assessor). " \
"This was approved by Humzah and Natalie on 16/04/2024."

CreateNote.call(application_form:, author: user, text: note)
end
end

0 comments on commit 04aac7f

Please sign in to comment.