Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save defong/cc086001f0974eec2fe61c8c11e77133 to your computer and use it in GitHub Desktop.
Save defong/cc086001f0974eec2fe61c8c11e77133 to your computer and use it in GitHub Desktop.
[DfE] 7229-m-test-the-publish-integration-and-turn-it-on-for-the-2024-2025-academic-year
# `existing_provider_and_publish_courses_count.csv`
# This contains a list of register providers and their related publish courses breakdown.
# So can create trainee and and use these as courses details
# `new_provider_and_publish_courses.csv`
# This contains a list of new providers that is not on register, and their related publish courses breakdown.
# So can create provider then create trainee and and use these as courses details
# `existing_provider_with_no_new_publish_courses.csv`
# This contains a list of register providers that did not have any new publish courses
# `new_provider.csv`
# This contains a list of new providers that is not on register
# When compared `existing_provider_with_no_new_publish_courses.csv` vs `new_provider.csv` there it seems that
# University of Buckingham is the only one with provider code change
# Teach First is a HPITT need to clarify what plan of action to take for them.
# The reminders from new_provider.csv seems to be just not exist on register for whatever reason.
courses_with_provider_code = Course.where(recruitment_cycle_year: 2024).pluck(:accredited_body_code).uniq.sort
all_provider_code = Provider.all.pluck(:code).uniq.sort
new_provider_code = courses_with_provider_code - all_provider_code
# On publish
new_provider_code = ["1BJ", "1SH", "24H", "2DB", "2V1", "3S3", "4E5", "5V5"]
new_provider = RecruitmentCycle.current.providers.where(provider_code: new_provider_code).map { |provider|
{provider_code: provider.provider_code,
provider_name: provider.provider_name }
}
items = new_provider
CSV.open("new_provider.csv", "wb") do |csv|
csv << items.first.keys
items.each do |hash|
csv << hash.values
end
end
existing_provider_with_no_new_publish_courses_provider_code = all_provider_code - courses_with_provider_code
existing_provider_with_no_new_publish_courses = Provider.where(code: existing_provider_with_no_new_publish_courses_provider_code).map do | provider |
{provider_code: provider.code,
provider_name: provider.name }
end
items = existing_provider_with_no_new_publish_courses
CSV.open("existing_provider_with_no_new_publish_courses.csv", "wb") do |csv|
csv << items.first.keys
items.each do |hash|
csv << hash.values
end
end
new_provider_with_name = [
["1BJ","Inspiring Leaders Primary (Leicester and Rutland)"],
["1SH","The Buckingham Partnership"],
["24H","Inspiring Leaders Primary (Nottinghamshire)"],
["2DB","Colchester Teacher Training (CTTC)"],
["2V1","Vantage North Humber Teacher Training"],
["3S3","SWIFT Teacher Training"],
["4E5","Embrace SCITT"],
["5V5","Mulberry College of Teaching"],
]
new_provider_and_publish_courses = new_provider_with_name.map {|c, n|
courses = Course.where(recruitment_cycle_year: 2024,accredited_body_code: c)
cc= Course.routes.keys.map {|k| [k, courses.where(route: k).count] }.to_h
{provider_code: c, provider_name: n, courses_count: courses.count}.merge(cc)}
items = new_provider_and_publish_courses
CSV.open("new_provider_and_publish_courses.csv", "wb") do |csv|
csv << items.first.keys
items.each do |hash|
csv << hash.values
end
end
courses_with_provider_code = .pluck(:accredited_body_code).uniq.sort
all_provider_code = Provider.all.pluck(:code).uniq.sort
existing_provider_and_publish_courses_count = (courses_with_provider_code & all_provider_code).map {|c|
courses = Course.where(recruitment_cycle_year: 2024,accredited_body_code: c)
cc= Course.routes.keys.map {|k| [k, courses.where(route: k).count] }.to_h
{provider_code: c, provider_name: Provider.find_by(code: c).name, courses_count: courses.count}.merge(cc)}
items = existing_provider_and_publish_courses_count
CSV.open("existing_provider_and_publish_courses_count.csv", "wb") do |csv|
csv << items.first.keys
items.each do |hash|
csv << hash.values
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment