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 / 7597-implement-interim-solution-for-apply-applications-from-extra-providers.rb
Last active October 3, 2024 12:25
[DfE] 7597-implement-interim-solution-for-apply-applications-from-extra-providers
‎‎​
@defong
defong / 7229-m-test-the-publish-integration-and-turn-it-on-for-the-2024-2025-academic-year.rb
Last active June 27, 2024 17:57
[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
@defong
defong / 2023-10-17.xml.rb
Last active November 1, 2023 11:55
[DfE] 6290-hertfordshire-uni-hesa-not-appearing-in-register
xml_response = Hesa::Client.get(url: "https://datacollection.hesa.ac.uk/apis/itt/1.1/CensusData/C23053/2023-10-26")
student_nodes = Nokogiri::XML::Reader(xml_response).filter_map do |node|
Nokogiri::XML(node.outer_xml).at("./Student") if node.name == "Student" && node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT
end
students = student_nodes.map do |student_node|
# student_attributes = Hash.from_xml(student_node.to_s)["Student"]
Hesa::Parsers::IttRecord.to_attributes(student_node:)
@defong
defong / 6057-itt-2022-3-husid-corrections-urgent.rb
Last active October 18, 2023 11:48
[DfE] 6057-itt-2022-3-husid-corrections-urgent.rb
corrections_required = [
["31009504/2/01","21100057900000137","2110750097246"],
["29002623/2/01","19100057900000123","1910750059931"],
["27034456/2/01","17100057900000163","1710750123984"],
["29020818/3/01","19100057900000536","1910750071885"],
["31021585/2/01","21100057900000023","2110750005355"],
["29024742/2/01","19100057900000570","1910750074015"],
["28012376/2/01","18100057900000148","1810750151559"],
["29005947/3/01","19100057900000824","1910750026715"],
["28016860/3/01","18100057900000182","1810750164696"],
@defong
defong / indexes---index_scan.psql
Last active October 13, 2023 08:30
[DfE] Register psql
-- NOTE: index scan indicator for busy table
SELECT
relname
, idx_scan
, last_idx_scan
FROM
pg_stat_user_tables
ORDER BY
idx_scan DESC
, relname ASC;
@defong
defong / 2299-rollover-courses-for-elluician.rb
Last active October 11, 2023 16:06
[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]
@defong
defong / 2293-reinstate-withdrawn-course.rb
Last active October 10, 2023 15:04
[DfE] 2293-reinstate-withdrawn-course
Please could Computing (3379) at Carmel College (1KF) have its withdrawal reverted
course = RecruitmentCycle.current.providers.find_by(provider_code: "1KF").courses.find_by(course_code: "3379")
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
@defong
defong / 2292-copy-courses-to-new-providers.rb
Last active October 10, 2023 14:32
[DfE] 2292-copy-courses-to-new-providers
copier = Courses::CopyToProviderService.new(sites_copy_to_course: Sites::CopyToCourseService, enrichments_copy_to_course: Enrichments::CopyToCourseService.new, force: true)
[
["1KN", "4B5"],
["1KY", "5B3"],
["1BK", "3M1"],
["2CC", "2O2"],
["1CU", "3V2"],
].each do |source, target|
@defong
defong / 2290-student-visa.rb
Last active October 10, 2023 10:32
[DfE] 2290-student-visa
# https://www.publish-teacher-training-courses.service.gov.uk/publish/organisations/1A8/2024/courses/372X
# https://www.publish-teacher-training-courses.service.gov.uk/publish/organisations/1A8/2024/courses/3735
#
# to no
courses = RecruitmentCycle.current.providers.find_by(provider_code: "1A8").courses.where(course_code: ["372X", "3735" ] )
courses.update!(can_sponsor_student_visa: false)
@defong
defong / 2289-visa-sponsorship.rb
Last active October 10, 2023 10:26
[DfE] 2289-visa-sponsorship
# https://www.publish-teacher-training-courses.service.gov.uk/publish/organisations/2JJ/2024/courses
#
# Change to yes
courses = RecruitmentCycle.current.providers.find_by(provider_code: "2JJ").courses
courses.update!(can_sponsor_student_visa: true)