Skip to content

Instantly share code, notes, and snippets.

View defong's full-sized avatar
🎯
Focusing

De Fong defong

🎯
Focusing
View GitHub Profile
@defong
defong / 2274-ellucian-sandbox-course-issue.rb
Last active October 5, 2023 11:04
[DfE] 2274-ellucian-sandbox-course-issue
#### Before state
run_me = false
(Provider.find_by(code: "EEU")) if run_me
#<Provider:0x00007fe5328a0768 id: 2619, name: "University of Ellucian", code: "EEU", created_at: Wed, 24 Feb 2021 12:23:48.431310000 GMT +00:00, updated_at: Mon, 20 Feb 2023 05:50:44.486124000 GMT +00:00, region_code: nil, postcode: "", provider_type: "university", latitude: nil, longitude: nil, vendor_id: nil>
# Supect rogue cache
# https://github.com/DFE-Digital/apply-for-teacher-training/blob/main/app/controllers/candidate_interface/course_choices/provider_selection_controller.rb#L8
# https://github.com/DFE-Digital/apply-for-teacher-training/blob/main/app/forms/candidate_interface/continuous_applications/provider_selection_step.rb#L12
(@provider_cache_key ||= "provider-list-#{Provider.maximum(:updated_at)}") if run_me
@defong
defong / 2272-update-visa-sponsorship-section.rb
Last active October 4, 2023 15:56
[DfE] 2272-update-visa-sponsorship-section
courses = RecruitmentCycle.current.providers.find_by(provider_code: "1KN").courses.where(course_code: ["3857", "H430", "3853", "384T", "384G", "38KK",])
courses.update!(can_sponsor_student_visa: false)
@defong
defong / 2269-update-accrediting-provider-on-courses.rb
Last active October 4, 2023 12:52
[DfE] 2269-update-accrediting-provider-on-courses
# https://qa.publish-teacher-training-courses.service.gov.uk/publish/organisations/G70/2024/courses
courses = RecruitmentCycle.current.providers.find_by(provider_code: "G70").courses.where(course_code: ["D514", "A102"])
courses.update!(accredited_provider_code: nil)
@defong
defong / 2267-update-course-start-date-from-april-2025-to-april-2024.rb
Last active October 4, 2023 11:09
[DfE] 2267-update-course-start-date-from-april-2025-to-april-2024
course = RecruitmentCycle.current.providers.find_by(provider_code: "L75").courses.find_by(course_code: "C577")
course.start_date = DateTime.parse("April 2024")
course.save!
# https://qa.find-postgraduate-teacher-training.service.gov.uk/course/L75/C577
# https://qa.publish-teacher-training-courses.service.gov.uk/publish/organisations/L75/2024/courses/C577/details
@defong
defong / 2265-move-all-courses-application-open-date-in-sandbox-to-3-october-2023-for-providers-with-codes-2a2-and-eeu.rb
Last active October 4, 2023 09:21
[DfE] 2265-move-all-courses-application-open-date-in-sandbox-to-3-october-2023-for-providers-with-codes-2a2-and-eeu.rb
if Rails.env.sandbox_aks? do
current_recruitment_cycle = RecruitmentCycle.current
applications_open_date = DateTime.parse("03 Oct 2023").beginning_of_day
current_recruitment_cycle.update!(application_start_date: applications_open_date)
provider_code = ["2A2", "EEU"]
providers = current_recruitment_cycle.reload.providers.where(provider_code:)
@defong
defong / 2261-page-not-found.rb
Last active October 3, 2023 15:59
[DfE] 2261-page-not-found
provider = RecruitmentCycle.current.providers.find_by(provider_code: "3D3")
provider.provider_name.strip!
provider.save
@defong
defong / 2263-copy-over-courses.rb
Last active October 3, 2023 15:12
[DfE] 2263-copy-over-courses
# Copies the courses for theses providers
providers_to_copy_to = RecruitmentCycle.current.providers.where(provider_code: [
"3FP"
])
provider_to_copy_from = RecruitmentCycle.current.providers.find_by(provider_code: "1FP")
courses = provider_to_copy_from.courses.where(accredited_provider_code: "C58")
@defong
defong / 2262-copy-over-courses.rb
Last active October 3, 2023 14:57
[DfE] 2262-copy-over-courses
# Copies the courses for theses providers
providers_to_copy_to = RecruitmentCycle.current.providers.where(provider_code: [
"3F4"
])
provider_to_copy_from = RecruitmentCycle.current.providers.find_by(provider_code: "3F2")
courses = provider_to_copy_from.courses.where.not(accredited_provider_code: "C58")
@defong
defong / 2259-remove-five-counties-scitt-the-priory-learning-trust-from-publish.rb
Last active October 3, 2023 10:20
[DfE] 2259-remove-five-counties-scitt-the-priory-learning-trust-from-publish
provider = RecruitmentCycle.current.providers.find_by(provider_code: "2R2")
provider.discard!
@defong
defong / 2258-urgent-visa-sponsorship.rb
Last active October 3, 2023 08:35
[DfE] 2258-urgent-visa-sponsorship
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)