This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider_codes = ["5V5"] | |
providers = RecruitmentCycle.current.providers.where(provider_code: provider_codes) | |
providers.update!(can_sponsor_skilled_worker_visa: false, can_sponsor_student_visa: false) | |
# # There is a validation issue with UKPRN | |
# provider = RecruitmentCycle.current.next.providers.where(provider_code: "1TW") | |
# provider.save!(can_sponsor_skilled_worker_visa: false, can_sponsor_student_visa:false, validate: false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RecruitmentCycle.current.next.providers.find_by(provider_code: "5K5").discard! | |
RecruitmentCycle.current.providers.find_by(provider_code: "5K5").discard! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################## | |
# First try | |
############################################## | |
provider = RecruitmentCycle.current.providers.find_by(provider_code: "P58") | |
course_codes = ["J265", "X659", "Q100", "C168", "F470", "G902", "F904", "K804"] | |
courses = provider.courses.where(course_code: course_codes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.publish-teacher-training-courses.service.gov.uk/publish/organisations/2A6/2024/courses/W611 | |
# https://www.publish-teacher-training-courses.service.gov.uk/publish/organisations/2A6/2024/courses/K018 | |
course = RecruitmentCycle.current.next.providers.find_by(provider_code: "2A6").courses.find_by(course_code: "W611") | |
course.enrichments.max_by(&:created_at).update(status: "draft", last_published_timestamp_utc: nil) | |
course.site_statuses.each do |site_status| | |
site_status.update(vac_status: :full_time_vacancies, status: :new_status, publish: :unpublished) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider = RecruitmentCycle.current.providers.find_by(provider_code: "N21") | |
course = RecruitmentCycle.current.next.providers.find_by(provider_code: "N21").courses.find_by(course_code: "U999") | |
course.update!(course_code: "IU99") | |
course = RecruitmentCycle.current.next.providers.find_by(provider_code: "N21").courses.find_by(course_code: "C758") | |
course.update!(course_code: "W9X1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider_codes = ["3M2","6H5","3E3","4M4","","D5D","7D7","3G3","2M1","7H7","8I8","7G7","8J8","7J7","6J6","4L4","5L5", | |
"3B2","3L2","3K3","3L1","3O3","5K5","4W4","2T3","5E5","5B5","5U5","5F5","4R4","4T4","2W1","6H6","6T6","8T8","4P2","2W2", | |
"3J3","3DR","8F8","5G5","5S3","4W6","4R1","2H5"] | |
providers = RecruitmentCycle.current.next.providers.where(provider_code: provider_codes) | |
providers.update!(can_sponsor_skilled_worker_visa: false, can_sponsor_student_visa: false) | |
# There is a validation issue with UKPRN | |
provider = RecruitmentCycle.current.next.providers.where(provider_code: "1TW") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copies the courses for theses providers | |
providers_to_copy_to = RecruitmentCycle.current.next.providers.where(provider_code: [ | |
"1WY" | |
]) | |
provider_to_copy_from = RecruitmentCycle.current.next.providers.find_by(provider_code: "T89") | |
courses = provider_to_copy_from.courses.published | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider = RecruitmentCycle.current.providers.find_by(provider_code: "27O") | |
courses = provider.courses.where(course_code: ["2RFG", "F392", "T695"]) | |
courses.each do |course| | |
course.enrichments.max_by(&:created_at).update(status: "published", last_published_timestamp_utc: Time.now.utc) | |
course.site_statuses.each do |site_status| | |
site_status.update(vac_status: :no_vacancies, status: :running) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copies the courses for theses providers | |
providers_to_copy_to = RecruitmentCycle.current.next.providers.where(provider_code: [ | |
"21J", | |
"2HE", | |
"1MN", | |
"21P", | |
"24P", | |
"1FE", | |
]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
users = User.all.filter_map { |user| { email: user.email, id: user.id, provider_ids: user.provider_ids, provider_names: user.providers.pluck(:name) } if user.provider_ids.present? } | |
items = users.map do |user| | |
trainees = Trainees::Filter.call(trainees: Trainee.includes({ provider: [:courses] }, :start_academic_cycle, :end_academic_cycle).not_draft.where(provider: {id: user[:provider_ids]}), filters: { academic_year: [AcademicCycle.previous.start_year] }) | |
user.merge(count: trainees.count ) | |
end | |
CSV.open("#{Rails.configuration.database_configuration["development"]["database"]}-love-sites-for-simon.csv", "wb") do |csv| |