Skip to content

Instantly share code, notes, and snippets.

@defong
Last active October 18, 2023 11:48
Show Gist options
  • Save defong/09e59b272e17e9dd2fef8ecd960ffc99 to your computer and use it in GitHub Desktop.
Save defong/09e59b272e17e9dd2fef8ecd960ffc99 to your computer and use it in GitHub Desktop.
[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"],
["28014106/3/01","18100057900000414","1810750154907"],
["27039607/2/01","19100057900000031","1910750026508"],
["29007106/2/01","19100057900000879","1910750062735"],
["29002665/2/01","19100057900000134","1910750077186"],
["31040363/2/01","21100057900000078","2110750027483"],
["28012821/2/01","18100057900000159","1810750152534"],
["29019575/2/01","19100057900000709","1910750093740"],
["29001647/2/01","19100057900000097","1910750059366"],
["31022636/2/01","21100057900000034","2110750054397"],
["26016975/2/01","16100057900000041","1610750052610"],
["27025936/3/01","18100057900000045","1810750114130"],
["27017355/3/01","17100057900000082","1710750112106"],
["27035154/3/01","18100057900000056","1810750116466"],
["29008040/2/01","19100057900000846","1910750087266"],
["24025331/4/01","15100057900000088","1510750023060"],
["27033911/3/01","17100057900000211","1710750123711"],
["31023702/2/01","21100057900000045","2110750052762"],
["29039123/2/01","19100057900000732","1910750102710"],
["29008365/2/01","19100057900000260","1910750087484"],
["27009996/2/01","17100057900000048","1710750104891"],
["29019913/2/01","19100057900000514","1910750071287"],
["29003786/2/01","19100057900000167","1910750078817"],
["27027870/3/01","17100057900000141","1710750155310"],
["28004887/3/01","18100057900000104","1810750135180"],
["29016728/2/01","19100057900000776","1910750069457"],
["31017007/2/01","21100057900000115","2110750066208"],
["16011982/2/01","06100057900000019","0000062007269"],
["31014372/2/01","21100057900000104","2110750071442"],
["24018931/3/01","14100057900000047","1410750050302"],
["27013820/4/01","18100057900000023","1810750097888"],
["26012332/2/01","16100057900000030","1610750044246"],
["29016302/2/01","19100057900000466","1910750092053"],
["25009059/3/01","15100057900000022","1510750040285"],
["29023514/2/01","19100057900000569","1910750073410"],
["29012685/2/01","19100057900000684","1910750089994"],
["27005927/4/01","18100057900000344","1810750094290"],
["25009083/4/01","15100057900000099","1510750040311"],
["29007618/2/01","19100057900000248","1910750086292"],
["29007454/3/01","19100057900000237","1910750014631"],
["22040346/2/01","12100057900000065","1310750106967"],
["29018888/2/01","19100057900000695","1910750093393"],
["29016015/2/01","19100057900000444","1910750091931"],
["29039778/3/01","19100057900000673","1910750055715"],
["14007766/3/01","04100057900000015","0000041341513"],
["25028598/4/01","15100057900000044","1510750071876"],
["28007306/3/01","18100057900000388","1810750141192"],
["28018312/4/01","18100057900000399","1810750169440"],
["26024760/3/01","16100057900000074","1610750066994"],
["24045710/4/01","15100057900000011","1510750025857"],
["21017435/2/01","11100057900000024","1110750053483"],
["28003329/2/01","18100057900000078","1810750132547"],
["28004507/2/01","18100057900000090","1810750134574"],
["30022510/2/01","20100057900000059","2010750091292"],
["29008805/2/01","19100057900000271","1910750087819"],
["2400429/3/01","14100057900000058","1410750024082"],
["27010767/3/01","17100057900000060","1710750105773"],
["28013381/2/01","18100057900000355","1810750153494"],
["27040076/3/01","17100057900000185","1710750056028"],
["29005068/3/01","19100057900000204","1910750061462"],
["20023508/2/01","10100057900000016","1010750119988"],
["29015815/2/01","19100057900000433","1910750068863"],
["29040210/2/01","19100057900000880","1910750085170"],
["29035746/3/01","19100057900000640","1910750029509"],
["25019339/4/01","16100057900000018","1610750016955"],
["29012453/3/01","19100057900000927","1910750066364"],
["29021282/2/01","19100057900000857","1910750072321"],
["26021942/2/01","16100057900000063","1610750061793"],
["29019986/3/01","19100057900000905","1910750094035"],
["29010899/2/01","19100057900000318","1910750065231"],
["18018434/2/01","12100057900000010","1210750082664"],
["28023406/3/01","18100057900000403","1810750180021"],
["29010567/2/01","19100057900000307","1910750064935"],
["25021437/2/01","16100057900000122","1610750017387"],
["23040483/3/01","13100057900000017","1310750215199"],
["28016939/5/01","18100057900000193","1810750165615"],
["28012978/4/01","18100057900000160","1810750152833"],
["25043339/4/01","15100057900000077","1510750102871"],
["29017365/2/01","19100057900000488","1910750092536"],
["28028225/2/01","18100057900000366","1810750189220"],
["29008045/2/01","19100057900000916","1910750087277"],
["29004401/2/01","19100057900000190","1910750060971"],
["28008764/3/01","18100057900000126","1810750144399"],
["29001385/2/01","19100057900000086","1910750075539"],
["28005816/4/01","18100057900000115","1810750136718"],
["29025207/2/01","19100057900000938","1910750095928"],
["31014358/2/01","21100057900000090","2110750071464"],
["29011240/2/01","19100057900000329","1910750089204"],
["27020551/2/01","17100057900000118","1710750114683"],
["27017859/3/01","18100057900000034","1810750099837"],
["29003854/2/01","19100057900000178","1910750060627"],
["28017049/5/01","18100057900000207","1810750165958"],
["30000694/2/01","20100057900000015","2010750066359"],
["26021639/2/01","16100057900000052","1610750061287"],
["28026308/2/01","18100057900000263","1810750185587"],
["29012634/2/01","19100057900000374","1910750066559"],
["29004077/2/01","19100057900000189","1910750060797"],
["26002768/2/01","16100057900000100","1610750006299"],
["21017145/2/01","11100057900000013","1110750052958"],
["28025258/3/01","18100057900000311","1810750183756"],
["29019617/3/01","19100057900000798","1910750043756"],
["29011579/2/01","19100057900000330","1910750089330"],
["29024774/2/01","19100057900000581","1910750074048"],
["29004661/3/01","19100057900000721","1910750025970"],
["24004650/5/01","14100057900000025","1410750024727"],
["27014224/2/01","17100057900000174","1710750153567"],
["19012720/4/01","14100057900000014","1410750009322"],
["28009827/2/01","18100057900000137","1810750146555"],
["29042548/4/01","19100057900000710","1910750277236"],
["29031414/2/01","19100057900000639","1910750097911"],
["25037881/3/01","15100057900000055","1510750085275"],
["29002594/2/01","19100057900000754","1910750059908"],
["17031131/2/01","07100057900000016","710750086093"],
["29018236/2/01","19100057900000499","1910750092983"],
["27010804/3/01","18100057900000012","1810750096261"],
["29025204/2/01","19100057900000592","1910750074255"],
["28018531/2/01","18100057900000229","1810750170125"],
["30035664/2/01","20100057900000037","2010750005668"],
["29025461/2/01","19100057900000606","1910750074392"],
["28004494/2/01","18100057900000089","1810750134552"],
["25023739/4/01","15100057900000103","1510750064568"],
["29019198/2/01","19100057900000503","1910750070811"],
["28039508/4/01","18100057900000285","1810750205999"],
["27020383/3/01","17100057900000107","1710750114513"],
["31052145/2/01","21100057900000160","2110750013947"],
["25017035/3/01","15100057900000033","1510750053975"],
["29035923/2/01","19100057900000651","1910750078987"],
["29000264/2/01","19100057900000064","1910750058602"],
["31007042/2/01","21100057900000148","2110750086398"],
["28022239/3/01","18100057900000241","1810750177412"],
["28017970/2/01","18100057900000322","1810750167985"],
["29003444/2/01","19100057900000156","1910750078220"],
["28044730/3/01","18100057900000296","1810750227991"],
["27014034/2/01","17100057900000071","1710750109195"],
["29006969/4/01","19100057900000226","1910750027217"],
["30012745/2/01","20100057900000026","2010750029631"],
["29009154/2/01","19100057900000293","1910750088023"],
["22010022/3/01","12100057900000021","1210750024044"],
["31019772/2/01","21100057900000126","2110750079862"],
["29021553/2/01","19100057900000558","1910750094600"],
["29002244/2/01","19100057900000112","1910750059713"],
["29011823/2/01","19100057900000341","1910750089514"],
["22019752/4/01","12100057900000054","1210750099248"],
["29038490/3/01","19100057900000662","1910750054202"],
["29013194/2/01","19100057900000385","1910750090314"],
["27022668/2/01","19100057900000020","1910750046311"],
["31026809/2/01","21100057900000067","2110750048628"],
["28015214/3/01","18100057900000171","1810750157137"],
["27006504/2/01","17100057900000196","1710750101100"],
["29007180/3/01","19100057900000891","1910750085527"],
["24005875/4/01","14100057900000036","1410750026949"],
["27022780/4/01","17100057900000130","1710750053131"],
["26002809/2/01","16100057900000029","1610750026312"],
["26025470/3/01","16100057900000085","1610750068415"],
["27017631/2/01","17100057900000093","1710750112335"],
["26004281/2/01","16100057900000111","1610750028877"],
["29007982/2/01","19100057900000259","1910750063259"],
["27010577/3/01","17100057900000059","1710750085545"],
["31009223/2/01","21100057900000089","2110750097419"],
["29001106/2/01","19100057900000075","1910750059078"],
["29013981/3/01","19100057900000396","1910750017779"],
["31015446/2/01","21100057900000159","2110750087786"],
["22012960/2/01","12100057900000032","1210750096683"],
["29028405/2/01","19100057900000617","1910750075481"],
["28025742/3/01","18100057900000252","1810750184557"],
["31023715/2/01","21100057900000056","2110750058502"],
["29012626/2/01","19100057900000363","1910750066548"],
["26015632/2/01","19100057900000019","1910750003026"],
["29002935/2/01","19100057900000145","1910750077566"],
["28005587/2/01","18100057900000300","1810750136279"],
["29039892/2/01","19100057900000835","1910750103810"],
["27034207/3/01","17100057900000152","1710750142804"],
["29026980/2/01","19100057900000802","1910750074978"],
["29020434/2/01","19100057900000525","1910750071597"],
["27004307/3/01","17100057900000200","1710750099092"],
["29016083/2/01","19100057900000455","1910750068988"],
["28035867/2/01","18100057900000274","1810750198093"],
["28022528/2/01","19100057900000053","1910750065323"],
["25022801/6/01","15100057900000066","1510750063284"],
["29015197/2/01","19100057900000411","1910750068472"],
["29015611/2/01","19100057900000422","1910750091735"],
["29002305/2/01","19100057900000868","1910750059735"],
["26029200/4/01","17100057900000015","1810750068844"],
["29014542/2/01","19100057900000400","1910750068106"],
["28022090/2/01","18100057900000230","1810750177124"],
["28022942/2/01","18100057900000333","1810750179151"],
["28018188/2/01","18100057900000218","1810750169082"],
["18005361/3/01","08100057900000013","810750048973"],
["28001436/2/01","18100057900000067","1810750130370"],
["28010532/2/01","19100057900000042","1910750046595"],
["27008803/2/01","17100057900000037","1710750103551"],
["29038320/3/01","19100057900000813","1910750032598"],
["17017200/2/01","07100057900000027","710750132345"],
["29005679/2/01","19100057900000215","1910750083040"],
["29021140/2/01","19100057900000547","1910750094460"],
["30014531/2/01","20100057900000060","2010750031324"],
["22018699/4/01","12100057900000076","1210750098780"],
["29018772/3/01","19100057900000787","1910750043240"],
["28039773/2/01","18100057900000377","1810750206354"],
["22017272/2/01","12100057900000043","1210750033840"],
["29011970/2/01","19100057900000352","1910750089558"],
["29016312/2/01","19100057900000477","1910750018673"],
["29002167/2/01","19100057900000101","1910750059687"],
["29009662/3/01","19100057900000765","1910750029381"],
["27004726/2/01","17100057900000026","1710750099472"],
["27022100/2/01","17100057900000129","1710750152308"],
["29008938/2/01","19100057900000282","1910750087901"],
]
provider = Provider.find_by!(code: "S21")
corrections_required.each do |trainee_id, existing_hesa_id, new_hesa_id|
trainee = provider.trainees.find_by!(trainee_id:, hesa_id: existing_hesa_id)
trainee.hesa_students.update!(hesa_id: new_hesa_id)
trainee.update!(hesa_id: new_hesa_id, audit_comment: "Previous hesa_id: #{existing_hesa_id}, was incorrect")
end
x = corrections_required.map do |trainee_id, existing_hesa_id, new_hesa_id|
trainee = provider.trainees.find_by!(trainee_id:, hesa_id: new_hesa_id)
"https://register-productiondata.teacherservices.cloud/trainees/#{trainee.slug}"
end
# x = corrections_required.map do |trainee_id, existing_hesa_id, new_hesa_id|
# trainee = provider.trainees.find_by!(trainee_id:, hesa_id: existing_hesa_id)
# trainee.hesa_students.count
# end
# # Sense checking....
# new_ids = corrections_required.map do |trainee_id, existing_hesa_id, new_hesa_id|
# new_hesa_id
# end
# Hesa::Student.where(hesa_id: new_ids)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment