Skip to content

Instantly share code, notes, and snippets.

@defong
Last active October 11, 2023 16:06
Show Gist options
  • Save defong/618ab548ab2745bc196f592470d502bb to your computer and use it in GitHub Desktop.
Save defong/618ab548ab2745bc196f592470d502bb to your computer and use it in GitHub Desktop.
[DfE] 2299-rollover-courses-for-elluician
#############################
# NOTE: OPTION 2
# Not checked need to be checked
#############################
raise "no checked"
course = RecruitmentCycle.current.previous.providers.find_by(provider_code: "EEU").first
dupes = [["L050", course], "R301",course, "E293", course, "K596", course]
copier = Courses::CopyToProviderService.new(sites_copy_to_course: Sites::CopyToCourseService, enrichments_copy_to_course: Enrichments::CopyToCourseService.new, force: true)
dupes.each do |course_code, course|
course.course_code = course_code
new_course = copier.execute(course:, new_provider: )
new_course.enrichments.first.draft! if new_course.present?
end
#############################
# OLD
#############################
provider_to_copy_from = RecruitmentCycle.current.previous.providers.find_by(provider_code: "EEU")
courses = provider_to_copy_from.courses
new_provider = RecruitmentCycle.current.providers.find_by(provider_code: "EEU")
copier = Courses::CopyToProviderService.new(sites_copy_to_course: Sites::CopyToCourseService, enrichments_copy_to_course: Enrichments::CopyToCourseService.new, force: true)
courses.each do |course|
new_course = copier.execute(course:, new_provider: )
new_course.enrichments.first.draft! if new_course.present?
end
courses_query = Course.where(course_code: ["L050", "R301", "E293", "K596"])
courses_query.map(&:to_s)
# ["Psychology (236/L050) [2022/23]", "Psychology (236/L050) [2023]", "Psychology (236/L050) [2024]", "Mathematics (2X5/R301) [2021/22]", "Mathematics (2X5/R301) [2022/23]"]
courses_query.map(&:provider).map(&:to_s)
# ["The Downland Alliance (236) [2022/23]", "The Downland Alliance (236) [2023]", "The Downland Alliance (236) [2024]", "Teach North: Nottinghamshire & North Lincolnshire (2X5) [2021/22]", "Teach North: Nottinghamshire & North Lincolnshire (2X5) [2022/23]"]
RecruitmentCycle.current.previous.providers.find_by(provider_code: "EEU").courses.map(&:to_s)
# ["Chemistry (EEU/F1X1) [2023]",
# "Design and Technology (EEU/W9X1) [2023]",
# "Physics (EEU/F3X1) [2023]",
# "Mathematics (EEU/G1X1) [2023]",
# "English (EEU/Q3X1) [2023]",
# "Music (EEU/W3X1) [2023]",
# "Primary (EEU/X100) [2023]",
# "Computing (EEU/IX99) [2023]",
# "Business Studies (EEU/N1X1) [2023]",
# "Primary with science (EEU/X581) [2023]",
# "Biology with mathematics (EEU/C1X1) [2023]"]
x = Provider.where(provider_code: "EES").flat_map do |provider|
provider.courses.map(&:to_s)
end
# I can confirm that these are last year recruitment cycle courses for provider code with EEU
# ```
# "Chemistry (EEU/F1X1) [2023]",
# "Design and Technology (EEU/W9X1) [2023]",
# "Physics (EEU/F3X1) [2023]",
# "Mathematics (EEU/G1X1) [2023]",
# "English (EEU/Q3X1) [2023]",
# "Music (EEU/W3X1) [2023]",
# "Primary (EEU/X100) [2023]",
# "Computing (EEU/IX99) [2023]",
# "Primary with science (EEU/X581) [2023]",
# "Business Studies (EEU/N1X1) [2023]",
# "Biology with mathematics (EEU/C1X1) [2023]",
# ```
# I can confirm that these are this year recruitment cycle courses for provider code with EEU
# ```
# "Mathematics (EEU/G1X1) [2024]",
# "Primary with mathematics (EEU/U906) [2024]",
# "Primary with science (EEU/X581) [2024]",
# "Chemistry (EEU/F1X1) [2024]",
# "Design and Technology (EEU/W9X1) [2024]",
# "Physics (EEU/F3X1) [2024]",
# "English (EEU/Q3X1) [2024]",
# "Music (EEU/W3X1) [2024]",
# "Primary (EEU/X100) [2024]",
# "Computing (EEU/IX99) [2024]",
# "Business Studies (EEU/N1X1) [2024]",
# "Biology with mathematics (EEU/C1X1) [2024]"
# ```
# I cannot find any provider with provider code EES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment