@obe-loms/coms-parser 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.js +19 -19
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
1
|
+
import _0x2d9c86 from 'papaparse';
|
|
2
|
+
import * as _0x50dc90 from 'xlsx';
|
|
3
3
|
|
|
4
|
-
function parseCurriculum(
|
|
4
|
+
function parseCurriculum(_0x347300){let _0x3aa0cd='',_0x335b62='',_0x55378e=0x0,_0x1fb566=null;const _0x124286=[];return _0x2d9c86['parse'](_0x347300,{'skipEmptyLines':!![],'complete':_0x571fa7=>{_0x571fa7['data']['forEach'](_0x38d0de=>{const _0x1c12d5=_0x38d0de['map'](_0x1eb09e=>(_0x1eb09e??'')['toString']()['trim']()),_0x4fff0c=_0x1c12d5[0x0]??'';if(_0x4fff0c['includes']('Rev#')){const _0x566768=_0x4fff0c['match'](/([A-Z0-9]+)\s*-\s*.*:\s*(.*?)\s+Rev#\s*(\d+)/i);_0x566768&&(_0x3aa0cd=_0x566768[0x1]?.['trim']()??'',_0x335b62=_0x566768[0x2]?.['trim']()??'',_0x55378e=parseInt(_0x566768[0x3]??'0',0xa));return;}if(/FIRST YEAR/i['test'](_0x4fff0c)){_0x1fb566=0x1;return;}if(/SECOND YEAR/i['test'](_0x4fff0c)){_0x1fb566=0x2;return;}if(/THIRD YEAR/i['test'](_0x4fff0c)){_0x1fb566=0x3;return;}if(/FOURTH YEAR/i['test'](_0x4fff0c)){_0x1fb566=0x4;return;}if(/FIFTH YEAR/i['test'](_0x4fff0c)){_0x1fb566=0x5;return;}if(/First Semester/i['test'](_0x4fff0c)||/Second Semester/i['test'](_0x4fff0c)||/Summer/i['test'](_0x4fff0c))return;const _0xe22c11=[{'sem':0x1,'offset':0x0},{'sem':0x2,'offset':0x6},{'sem':0x3,'offset':0xc}];_0xe22c11['forEach'](({sem:_0x278270,offset:_0x5e67b4})=>{const _0x45e8ca=_0x1c12d5[_0x5e67b4]??'',_0x25878b=_0x1c12d5[_0x5e67b4+0x1]??'',_0x59d607=_0x1c12d5[_0x5e67b4+0x2]??'',_0x1f4ff=_0x1c12d5[_0x5e67b4+0x3]??'',_0x3894e5=_0x1c12d5[_0x5e67b4+0x4]??'';_0x45e8ca&&_0x1fb566&&_0x124286['push']({'curr_id':_0x3aa0cd,'program_name':_0x335b62,'revision_no':_0x55378e,'year_level':_0x1fb566,'sem':_0x278270,'course_id':_0x45e8ca,'course_desc':_0x25878b,'total_units':_0x59d607,'lec_unit':_0x1f4ff,'lab_unit':_0x3894e5});});});}}),_0x124286;}
|
|
5
5
|
|
|
6
|
-
function convertToCSVFile(
|
|
6
|
+
function convertToCSVFile(_0x3fd795){return new Promise((_0x3652fa,_0x5c435a)=>{const _0x3a0c20=new FileReader();_0x3a0c20['onload']=_0x13a877=>{const _0x3c2e94=_0x13a877['target']?.['result'];if(!_0x3c2e94){_0x5c435a(new Error('Failed\x20to\x20read\x20file'));return;}try{const _0x23fb42=_0x50dc90['read'](_0x3c2e94,{'type':'array'}),_0x2adb68=_0x23fb42['SheetNames'][0x0];if(!_0x2adb68){_0x5c435a(new Error('No\x20sheets\x20found\x20in\x20workbook'));return;}const _0x560210=_0x23fb42['Sheets'][_0x2adb68];if(!_0x560210){_0x5c435a(new Error('No\x20sheets\x20found\x20in\x20worksheet'));return;}const _0x3a1c57=_0x50dc90['utils']['sheet_to_csv'](_0x560210,{'strip':!![]}),_0xd122ce=_0x3fd795['name']['replace'](/\.[^/.]+$/,'.csv'),_0xf2713b=new File([_0x3a1c57],_0xd122ce,{'type':'text/csv','lastModified':Date['now']()});_0x3652fa(_0xf2713b);}catch(_0x191526){_0x5c435a(_0x191526);}},_0x3a0c20['onerror']=()=>{_0x5c435a(new Error('File\x20reading\x20failed'));},_0x3a0c20['readAsArrayBuffer'](_0x3fd795);});}
|
|
7
7
|
|
|
8
|
-
async function uploadCurriculum(
|
|
8
|
+
async function uploadCurriculum(_0x30fe1b,_0x549901){try{const _0x2f8f01=await convertToCSVFile(_0x549901),_0x1726ea=await _0x2f8f01['text'](),_0xa4765f=parseCurriculum(_0x1726ea),_0x11baaa=_0x2d9c86['unparse'](_0xa4765f),_0x29715a=new File([_0x11baaa],_0x2f8f01['name'],{'type':'text/csv'}),_0x3bac80=new FormData();_0x3bac80['append']('csvFile',_0x29715a);const _0x145006=await fetch(_0x30fe1b+'/curr-courses/upload',{'method':'POST','body':_0x3bac80});if(!_0x145006['ok']){const _0x5896a5=await _0x145006['json']();throw _0x5896a5;}return _0x145006['json']();}catch(_0x44fed2){throw _0x44fed2;}}
|
|
9
9
|
|
|
10
|
-
function parseCourseOffering(
|
|
10
|
+
function parseCourseOffering(_0x3bcc1d){let _0x11d2ee='',_0x36a22b='';const _0x4e10d7=[],_0x12b344=_0x2d9c86['parse'](_0x3bcc1d,{'header':![],'skipEmptyLines':!![],'delimiter':','}),_0x344053=_0x12b344['data'];for(let _0x4d5f0e=0x0;_0x4d5f0e<Math['min'](0x5,_0x344053['length']);_0x4d5f0e++){const _0x5a8cc4=_0x344053[_0x4d5f0e];if(_0x5a8cc4&&_0x5a8cc4['length']>0x0){const _0x22a359=_0x5a8cc4[0x0]?.['toString']()||'',_0x5bbc5d=_0x22a359['match'](/(First|Second)\s+Sem\s+S\/Y\s+(\d{4}-\d{4})/i);if(_0x5bbc5d){_0x11d2ee=_0x5bbc5d[0x1]?.['toLowerCase']()==='first'?'1':'2';if(_0x5bbc5d[0x2]){const _0x37da5d=_0x5bbc5d[0x2]['match'](/(\d{2})(\d{2})-(\d{2})(\d{2})/);_0x37da5d&&_0x37da5d[0x2]&&_0x37da5d[0x4]&&(_0x36a22b=_0x37da5d[0x2]+_0x37da5d[0x4]);}}}}let _0x1dcf46=-1;for(let _0x4c02d9=0x0;_0x4c02d9<_0x344053['length'];_0x4c02d9++){const _0x1b0e1a=_0x344053[_0x4c02d9];if(_0x1b0e1a&&_0x1b0e1a['some'](_0x21d509=>_0x21d509?.['toString']()['toUpperCase']()['includes']('CODE'))){_0x1dcf46=_0x4c02d9;break;}}if(_0x1dcf46===-1)throw new Error('Could\x20not\x20find\x20header\x20row\x20in\x20CSV\x20data');let _0x5c77d0={'code':'','description':'','unit':0x0};for(let _0x598eb2=_0x1dcf46+0x1;_0x598eb2<_0x344053['length'];_0x598eb2++){const _0x5d33d4=_0x344053[_0x598eb2];if(!_0x5d33d4||_0x5d33d4['length']<0x8)continue;const _0x4c0762=_0x5d33d4[0x1]?.['toString']()['trim']()||'',_0x2ab369=_0x5d33d4[0x4]?.['toString']()['trim']()||'',_0x51a95=_0x5d33d4[0x5]?.['toString']()['trim']()||'',_0x258d59=_0x5d33d4[0x6]?.['toString']()['trim']()||'',_0x20b34a=_0x5d33d4[0x7]?.['toString']()['trim']()||'',_0x147280=_0x5d33d4[0x3]?.['toString']()['trim']()||'';let _0x291b15=_0x5d33d4[0x0]?.['toString']()['trim']()||'',_0x5bf1fe=_0x5d33d4[0x2]?.['toString']()['trim']()||'';if(!_0x4c0762)continue;if(!_0x291b15)_0x291b15=_0x5c77d0['code'];if(!_0x5bf1fe)_0x5bf1fe=_0x5c77d0['description'];let _0x38ab7c=_0x5c77d0['unit'];if(_0x147280){const _0x1b3ba9=_0x147280['match'](/(\d+)/);_0x1b3ba9&&_0x1b3ba9[0x1]&&(_0x38ab7c=parseInt(_0x1b3ba9[0x1],0xa));}const _0x451754={'sem':_0x11d2ee,'school_year':_0x36a22b,'code':_0x291b15,'course_no':_0x4c0762,'course_desc':_0x5bf1fe,'unit':_0x38ab7c,'time':_0x2ab369,'days':_0x51a95,'faculty':_0x258d59,'room':_0x20b34a};_0x5c77d0['code']=_0x291b15,_0x5c77d0['description']=_0x5bf1fe,_0x5c77d0['unit']=_0x38ab7c,_0x4e10d7['push'](_0x451754);}return _0x4e10d7;}
|
|
11
11
|
|
|
12
|
-
async function uploadCourseOffering(
|
|
12
|
+
async function uploadCourseOffering(_0x4d1b58,_0x23b9ac){try{const _0x37d20f=await convertToCSVFile(_0x23b9ac),_0x353076=await _0x37d20f['text'](),_0x34ff72=parseCourseOffering(_0x353076),_0x3b411e=_0x2d9c86['unparse'](_0x34ff72),_0x44f91e=new File([_0x3b411e],_0x37d20f['name'],{'type':'text/csv'}),_0x9d3785=new FormData();_0x9d3785['append']('csvFile',_0x44f91e);const _0x5aafd5=await fetch(_0x4d1b58+'/course-offerings/upload',{'method':'POST','body':_0x9d3785});if(!_0x5aafd5['ok']){const _0x213575=await _0x5aafd5['json']();throw _0x213575;}return _0x5aafd5['json']();}catch(_0xf7fc09){throw _0xf7fc09;}}
|
|
13
13
|
|
|
14
|
-
function performaceTarget(
|
|
14
|
+
function performaceTarget(_0x31c329){if(!_0x31c329)return {'performance_target':null,'passing_score':null};const _0x25fa4c=_0x31c329['match'](/\d+/g);return {'performance_target':_0x25fa4c?.[0x0]?parseInt(_0x25fa4c[0x0],0xa):null,'passing_score':_0x25fa4c?.[0x1]?parseInt(_0x25fa4c[0x1],0xa):null};}
|
|
15
15
|
|
|
16
|
-
function extractInstructionalVerb(
|
|
16
|
+
function extractInstructionalVerb(_0x300892){const _0x3ee781=_0x300892['trim'](),_0x1b0bcc=/\b(will|shall)\b\s+(?:be\s+able\s+to\s+)?([a-zA-Z]+)/i,_0x2de270=_0x3ee781['match'](_0x1b0bcc);return _0x2de270&&_0x2de270[0x2]!==undefined?_0x2de270[0x2]:null;}
|
|
17
17
|
|
|
18
|
-
const HEADERS={'co':['course\x20outcome','co\x20statement','outcome\x20statement'],'ilo':['intended\x20learning','ilo','learning\x20outcome'],'assessTool':['assessment\x20tool','assessment\x20method','tool'],'perfTarget':['performance\x20target','target','passing']};function getCoaepHeader(
|
|
18
|
+
const HEADERS={'co':['course\x20outcome','co\x20statement','outcome\x20statement'],'ilo':['intended\x20learning','ilo','learning\x20outcome'],'assessTool':['assessment\x20tool','assessment\x20method','tool'],'perfTarget':['performance\x20target','target','passing']};function getCoaepHeader(_0x48b2aa){let _0x159cf1={'headerRowIndex':-1,'coIdx':-1,'iloIdx':-1,'assessToolIdx':-1,'perfTargetIdx':-1};for(let _0x4260c7=0x0;_0x4260c7<Math['min'](_0x48b2aa['length'],0x14);_0x4260c7++){const _0x2ca2a4=(_0x48b2aa[_0x4260c7]??[])['map'](_0x591f59=>_0x591f59['toLowerCase']()['trim']()),_0x14c938=_0x2ca2a4['findIndex'](_0x24caaf=>HEADERS['co']['some'](_0x5f3202=>_0x24caaf['includes'](_0x5f3202))),_0xee2577=_0x2ca2a4['findIndex'](_0x27c121=>HEADERS['ilo']['some'](_0x154ebb=>_0x27c121['includes'](_0x154ebb))),_0x4e821d=_0x2ca2a4['findIndex'](_0x8354e8=>HEADERS['assessTool']['some'](_0x43273e=>_0x8354e8['includes'](_0x43273e))),_0x1e896f=_0x2ca2a4['findIndex'](_0x100985=>HEADERS['perfTarget']['some'](_0x4c22e5=>_0x100985['includes'](_0x4c22e5))),_0x1061e5=[_0x14c938,_0xee2577,_0x4e821d,_0x1e896f]['filter'](_0x4662ba=>_0x4662ba!==-1)['length'];if(_0x1061e5>=0x3){_0x159cf1={'headerRowIndex':_0x4260c7,'coIdx':_0x14c938,'iloIdx':_0xee2577,'assessToolIdx':_0x4e821d,'perfTargetIdx':_0x1e896f};break;}}return _0x159cf1;}
|
|
19
19
|
|
|
20
|
-
function parseCOAEP(
|
|
20
|
+
function parseCOAEP(_0x3a0115){const _0x213223=_0x2d9c86['parse'](_0x3a0115,{'skipEmptyLines':![]})['data'],_0x5bb742={'COAEP':{'faculty':null,'course':null,'sy':null,'semester':null,'co':[]}},{headerRowIndex:_0x164a88,coIdx:_0x1bb669,iloIdx:_0x3650ca,assessToolIdx:_0x2d9a34,perfTargetIdx:_0x2d075b}=getCoaepHeader(_0x213223);if(_0x164a88===-1)return {'error':'Could\x20not\x20auto-detect\x20header\x20row.','message':'Please\x20ensure\x20the\x20CSV\x20file\x20is\x20in\x20the\x20correct\x20COAEP\x20format.'};_0x213223['forEach'](_0x1f1fee=>{const _0x4f9c4d=_0x1f1fee['indexOf']('Name\x20of\x20Faculty:'),_0xe00c8d=_0x1f1fee['indexOf']('School\x20Year'),_0xa27c35=_0x1f1fee['indexOf']('Course:'),_0x2a119e=_0x1f1fee['indexOf']('Semester');_0x4f9c4d!==-1&&(_0x5bb742['COAEP']['faculty']=_0x1f1fee[_0x4f9c4d+0x1]?.['trim']()||_0x5bb742['COAEP']['faculty']);_0xe00c8d!==-1&&(_0x5bb742['COAEP']['sy']=_0x1f1fee[_0xe00c8d+0x1]?.['trim']()||_0x5bb742['COAEP']['sy']);_0xa27c35!==-1&&(_0x5bb742['COAEP']['course']=_0x1f1fee[_0xa27c35+0x1]?.['trim']()||_0x5bb742['COAEP']['course']);if(_0x2a119e!==-1){const _0x1fedc1=_0x1f1fee[_0x2a119e+0x1]?.['trim']()||'',_0x399186=_0x1fedc1['match'](/\d+/)?.[0x0];_0x5bb742['COAEP']['semester']=_0x399186?parseInt(_0x399186,0xa):_0x5bb742['COAEP']['semester'];}});let _0x5e614f=null;return _0x213223['forEach']((_0x13b881,_0xfc4060)=>{if(_0xfc4060<=_0x164a88)return;let _0x125644=_0x13b881[_0x1bb669-0x1]?.['trim']()||'',_0x57dccf=_0x13b881[_0x1bb669]?.['trim']()||'';/^\d+$/['test'](_0x13b881[_0x1bb669]?.['trim']()||'')&&(_0x125644=_0x13b881[_0x1bb669]?.['trim']()||'',_0x57dccf=_0x13b881[_0x1bb669+0x1]?.['trim']()||'');const _0x3dacf1=_0x13b881[_0x3650ca]?.['trim']()||'',_0x500eda=_0x13b881[_0x2d9a34]?.['replace'](/^ILO\d+[:.]?\s*/,'')['trim']()||'',_0x2a4e2e=_0x13b881[_0x2d075b]?.['replace'](/\s+/g,'\x20')['trim']()||'';if(_0x125644&&/^\d+$/['test'](_0x125644)){_0x5e614f&&_0x5bb742['COAEP']['co']['push'](_0x5e614f);const _0x410eed=_0x57dccf,_0x186069=extractInstructionalVerb(_0x410eed)||'';_0x5e614f={'statement':_0x410eed,'verb':_0x186069,'ilo':[]};}if(_0x5e614f&&_0x3dacf1&&_0x2a4e2e){const _0x38e1b1=_0x3dacf1['replace'](/^ILO\d+[:.]?\s*/,'');if(_0x38e1b1['match'](/^(Revision|Prepared|Date|Approved|Effectivity|Page)/i)||_0x38e1b1['length']<0xa)return;let _0x371243=_0x500eda;if(!_0x371243&&_0x38e1b1['includes'](':')){const _0x1d6991=_0x38e1b1['match'](/^ILO\d+:\s*(.+?)(?:\s*\(|$)/);_0x1d6991&&(_0x371243=_0x1d6991[0x1]?.['trim']()||'');}const {performance_target:_0x353c6e,passing_score:_0x27ab99}=performaceTarget(_0x2a4e2e);_0x5e614f['ilo']['push']({'statement':_0x38e1b1,'verb':extractInstructionalVerb(_0x38e1b1)||'','assessment_tool':_0x371243,'performance_target':_0x353c6e,'passing_score':_0x27ab99});}}),_0x5e614f&&_0x5bb742['COAEP']['co']['push'](_0x5e614f),_0x5bb742;}
|
|
21
21
|
|
|
22
|
-
async function uploadCOAEP(
|
|
22
|
+
async function uploadCOAEP(_0x4c1b81,_0x5776c0,_0x1a24fa){try{const _0x2f57b5=await convertToCSVFile(_0x5776c0),_0x27b1fe=await _0x2f57b5['text'](),_0x2339b8=parseCOAEP(_0x27b1fe);console['log'](_0x2339b8);const _0x5b15bb=await fetch(_0x4c1b81+'/coaeps/upload?course_id='+_0x1a24fa,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x2339b8)});if(!_0x5b15bb['ok']){const _0x4c47de=await _0x5b15bb['json']();throw _0x4c47de;}return _0x5b15bb['json']();}catch(_0x389c98){throw _0x389c98;}}
|
|
23
23
|
|
|
24
|
-
async function uploadEnrolledStudent(
|
|
24
|
+
async function uploadEnrolledStudent(_0x5ef5ef,_0x341538){try{const _0x400b93=await convertToCSVFile(_0x341538),_0x1f04ca=new FormData();_0x1f04ca['append']('csvFile',_0x400b93);const _0x19cc94=await fetch(_0x5ef5ef+'/enrolled-students/upload',{'method':'POST','body':_0x1f04ca});if(!_0x19cc94['ok']){const _0x288502=await _0x19cc94['json']();throw _0x288502;}return _0x19cc94['json']();}catch(_0x3f0912){throw _0x3f0912;}}
|
|
25
25
|
|
|
26
|
-
function parseClassList(
|
|
26
|
+
function parseClassList(_0x5d446c){const _0x402849=_0x2d9c86['parse'](_0x5d446c,{'skipEmptyLines':!![]})['data'];let _0x40aa33='',_0x4a463f='',_0x1aa2fa='';const _0x201389=[];return _0x402849['forEach'](_0xa365cd=>{const _0x10b32b=_0xa365cd['map'](_0x287726=>(_0x287726??'')['toString']()['trim']()),_0x4da441=_0x10b32b[0x0]??'';if(_0x4da441['startsWith']('Course\x20No:')){const _0x1e43c0=_0x4da441['replace']('Course\x20No:','')['trim'](),_0x16d9d8=_0x1e43c0['split'](/\s+/);_0x1aa2fa=_0x16d9d8[0x0]??'';const [_0x290492,_0x26545a]=(_0x16d9d8[0x1]??'')['split']('-');_0x4a463f=_0x290492??'';const _0x31b820=(_0x26545a??'')['match'](/[a-z]$/);_0x40aa33=_0x31b820?_0x31b820[0x0]:'';}if(/^\d+$/['test'](_0x4da441)){const _0x2bc8cb=_0x10b32b[0x2]??'';_0x201389['push']({'subj_code':_0x1aa2fa,'student_no':_0x2bc8cb,'course_id':_0x4a463f,'section':_0x40aa33});}}),{'enrolledCourses':_0x201389};}
|
|
27
27
|
|
|
28
|
-
async function uploadClassList(
|
|
28
|
+
async function uploadClassList(_0x30afe2,_0x34f22f,_0x2e929e,_0x2d8978){try{const _0x30848d=await convertToCSVFile(_0x34f22f),_0x2bbd4c=await _0x30848d['text'](),_0x91cecc=parseClassList(_0x2bbd4c),_0x38a6ac='subj_code='+_0x2e929e+'&period_id='+_0x2d8978,_0x1b61a1=await fetch(_0x30afe2+'/enrolled-courses/upload?'+_0x38a6ac,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x91cecc)});if(!_0x1b61a1['ok']){const _0x5d7f3c=await _0x1b61a1['json']();throw _0x5d7f3c;}return _0x1b61a1['json']();}catch(_0x5698e2){throw _0x5698e2;}}
|
|
29
29
|
|
|
30
|
-
function parseAssessmentCsv(
|
|
30
|
+
function parseAssessmentCsv(_0x56a435){const {data:_0xac7db3}=_0x2d9c86['parse'](_0x56a435,{'skipEmptyLines':!![]}),_0x478759=_0xac7db3['filter'](_0x38e2ed=>_0x38e2ed['length']>0x0),_0x12c206=_0x478759['find'](_0x381e40=>_0x381e40['some'](_0x2ac434=>_0x2ac434?.['includes']('Faculty'))),_0x37861e=_0x12c206?_0x12c206['findIndex'](_0x3bd104=>_0x3bd104?.['includes']('Faculty')):-1,_0x2c8af4=_0x37861e!==-1&&_0x12c206?_0x12c206[_0x37861e+0x2]?.['replace'](/"/g,'')['trim']()??'':'',_0x56d635=_0x478759['find'](_0x30758e=>_0x30758e['some'](_0x18fd74=>_0x18fd74?.['includes']('Semester'))),_0xd07977=_0x56d635?_0x56d635['findIndex'](_0x36a554=>_0x36a554?.['includes']('Semester')):-1,_0x267f1e=_0xd07977!==-1&&_0x56d635?_0x56d635[_0xd07977+0x2]?.['trim']()??'':'',_0x2b7d58=_0x267f1e['includes']('1st')?0x1:_0x267f1e['includes']('2nd')?0x2:0x0,_0x449358=_0x478759['find'](_0x5c2e24=>_0x5c2e24['some'](_0x4ba300=>_0x4ba300?.['includes']('Course\x20&\x20Sec'))),_0x131557=_0x449358?_0x449358['findIndex'](_0x2d20b2=>_0x2d20b2?.['includes']('Course\x20&\x20Sec')):-1,_0x497f31=_0x131557!==-1&&_0x449358?_0x449358[_0x131557+0x2]?.['trim']()??'':'';let _0x13b36c='',_0x206f57='';if(_0x497f31){const _0x3e2597=_0x497f31['match'](/^([A-Za-z0-9]+)-?([A-Za-z]+)?/);_0x3e2597&&(_0x13b36c=_0x3e2597[0x1]??'',_0x3e2597[0x2]&&(_0x206f57=_0x3e2597[0x2]['replace'](/^OC/i,'')));}const _0x2e2c5b=_0x478759['find'](_0x2e8fef=>_0x2e8fef['some'](_0x18b194=>_0x18b194?.['includes']('School\x20Year'))),_0x32ac04=_0x2e2c5b?_0x2e2c5b['findIndex'](_0x5b1eb5=>_0x5b1eb5?.['includes']('School\x20Year')):-1,_0x49319a=_0x32ac04!==-1&&_0x2e2c5b?_0x2e2c5b[_0x32ac04+0x2]?.['trim']()??'':'';let _0x4e0bc8=0x0;if(_0x49319a){const _0x589066=_0x49319a['match'](/(\d{4})-(\d{4})/);if(_0x589066){const _0x1e8e45=(_0x589066[0x1]??'')['slice'](0x2),_0x25a5e2=(_0x589066[0x2]??'')['slice'](0x2);_0x4e0bc8=parseInt(_0x1e8e45+_0x25a5e2,0xa);}}const _0x4df460={'faculty':_0x2c8af4,'course':_0x13b36c,'section':_0x206f57,'semester':_0x2b7d58,'sy':_0x4e0bc8},_0x502709=_0x478759['findIndex'](_0x1f0ea=>_0x1f0ea['some'](_0x3e0ee5=>_0x3e0ee5?.['trim']()==='CO\x20#'));if(_0x502709===-1)throw new Error('CO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x3a30dc=_0x478759[_0x502709+0x1];if(!_0x3a30dc)throw new Error('ILO\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x389da7={};let _0x5be7b5=0x1,_0xe9cf74=0x1;for(let _0x17e4c9=0x3;_0x17e4c9<_0x3a30dc['length'];_0x17e4c9++){const _0x2fc080=_0x3a30dc[_0x17e4c9];if(!_0x2fc080)continue;const _0x3eb0e0='co'+_0x5be7b5;if(!_0x389da7[_0x3eb0e0])_0x389da7[_0x3eb0e0]=[];_0x389da7[_0x3eb0e0]['push']('ilo'+_0xe9cf74),_0xe9cf74++,_0xe9cf74>0x3&&(_0x5be7b5++,_0xe9cf74=0x1);}const _0x4847fa=_0x478759['findIndex'](_0x1ecb54=>_0x1ecb54['includes']('Name\x20of\x20Students'));if(_0x4847fa===-1)throw new Error('Student\x20header\x20row\x20not\x20found\x20in\x20CSV');const _0x11e9ea=_0x478759[_0x4847fa];if(!_0x11e9ea)throw new Error('Student\x20header\x20row\x20is\x20missing');const _0x27a107=_0x11e9ea['findIndex'](_0x16d307=>_0x16d307?.['includes']('Name\x20of\x20Students'));if(_0x27a107===-1)throw new Error('Name\x20of\x20Students\x20column\x20not\x20found\x20in\x20CSV');const _0x23750c=_0x27a107+0x2,_0x377547=[];for(let _0x1d7cce=_0x4847fa+0x1;_0x1d7cce<_0x478759['length'];_0x1d7cce++){const _0x46c9cf=_0x478759[_0x1d7cce];if(!_0x46c9cf)continue;if(_0x46c9cf['some'](_0x57f958=>_0x57f958?.['toUpperCase']()['includes']('TOTAL\x20STUDENTS')||_0x57f958?.['toUpperCase']()['includes']('ACHIEVED\x20THE\x20MINIMUM')||_0x57f958?.['toUpperCase']()['includes']('INACTIVE')||_0x57f958?.['toUpperCase']()['includes']('AVERAGE')))continue;if(!_0x46c9cf[_0x27a107])continue;const _0x210b04=_0x46c9cf[_0x27a107]['replace'](/"/g,'')['trim'](),_0x51601e=_0x46c9cf['slice'](_0x23750c)['map'](_0x181453=>_0x181453===null?null:!isNaN(Number(_0x181453))?parseFloat(_0x181453):0x0);let _0x424ff0=0x0;const _0x126a49={};Object['entries'](_0x389da7)['forEach'](([_0x302571,_0x319959])=>{const _0x4d50b1={};_0x319959['forEach'](_0x4f901f=>{_0x4d50b1[_0x4f901f]=_0x51601e[_0x424ff0]??0x0,_0x424ff0++;}),_0x126a49[_0x302571]={'transmuted_score':_0x4d50b1};}),_0x377547['push']({'student_name':_0x210b04,'coaep':_0x126a49});}const _0x474a26=_0x478759['find'](_0x3569de=>_0x3569de['some'](_0x4026fe=>_0x4026fe?.['includes']('ACHIEVED\x20THE\x20MINIMUM'))),_0x45aeba=_0x478759['find'](_0x3e17b0=>_0x3e17b0['some'](_0x2d8b9f=>_0x2d8b9f?.['includes']('AVERAGE'))),_0x47dfa3=_0x474a26?_0x474a26['slice'](_0x23750c)['map'](_0x29285f=>_0x29285f&&!isNaN(Number(_0x29285f))?parseInt(_0x29285f):0x0):[],_0x21e981=_0x45aeba?_0x45aeba['slice'](_0x23750c)['map'](_0xc041a0=>_0xc041a0&&_0xc041a0!=='#DIV/0!'&&!isNaN(Number(_0xc041a0))?parseInt(_0xc041a0):0x0):[],_0x4f42c0={};let _0xd9afd4=0x0;return Object['entries'](_0x389da7)['forEach'](([_0x1f5d78,_0x22f9e7])=>{if(!_0x4f42c0[_0x1f5d78])_0x4f42c0[_0x1f5d78]={};_0x22f9e7['forEach'](_0x5b9682=>{_0x4f42c0[_0x1f5d78][_0x5b9682]={'achievedMinimum':_0x47dfa3[_0xd9afd4]??0x0,'average':_0x21e981[_0xd9afd4]??0x0},_0xd9afd4++;});}),{'assessmentData':{'classAssignment':_0x4df460,'student':_0x377547,'total':_0x4f42c0}};}
|
|
31
31
|
|
|
32
|
-
async function uploadAssessmentData(
|
|
32
|
+
async function uploadAssessmentData(_0x4a559c,_0x52dc02){try{const _0x210e14=await convertToCSVFile(_0x52dc02),_0x9afe0a=await _0x210e14['text'](),_0x3fb4a5=parseAssessmentCsv(_0x9afe0a),_0x2bce3b=await fetch(_0x4a559c+'/assessment-data/upload',{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](_0x3fb4a5)});if(!_0x2bce3b['ok']){const _0x2acb29=await _0x2bce3b['json']();throw _0x2acb29;}return _0x2bce3b['json']();}catch(_0x227cb7){throw _0x227cb7;}}
|
|
33
33
|
|
|
34
|
-
async function uploadDeptFaculty(
|
|
34
|
+
async function uploadDeptFaculty(_0x30ce9b,_0x34ac81){try{const _0x43d3ac=await convertToCSVFile(_0x34ac81),_0x57c83e=new FormData();_0x57c83e['append']('csvFile',_0x43d3ac);const _0x1f394c=await fetch(_0x30ce9b+'/dept-faculties/upload',{'method':'POST','body':_0x57c83e});if(!_0x1f394c['ok']){const _0x58e202=await _0x1f394c['json']();throw _0x58e202;}return _0x1f394c['json']();}catch(_0x2708b9){throw _0x2708b9;}}
|
|
35
35
|
|
|
36
|
-
class Client{['BASE_URL'];constructor(
|
|
36
|
+
class Client{['BASE_URL'];constructor(_0x35548a){this['BASE_URL']=_0x35548a;}['Parser'](){return {'curriculum':async _0xaed122=>{const _0x18037e=await uploadCurriculum(this['BASE_URL'],_0xaed122);return _0x18037e;},'courseOffering':async _0xfcdf76=>{const _0x745c67=await uploadCourseOffering(this['BASE_URL'],_0xfcdf76);return _0x745c67;},'coaep':async(_0xb534b2,_0x3ba410)=>{const _0x2b5874=await uploadCOAEP(this['BASE_URL'],_0xb534b2,_0x3ba410);return _0x2b5874;},'enrolledStudent':async _0x17eb52=>{const _0x427472=await uploadEnrolledStudent(this['BASE_URL'],_0x17eb52);return _0x427472;},'classlist':async(_0x348a6b,_0xae09e2,_0x45dad1)=>{const _0x463de0=await uploadClassList(this['BASE_URL'],_0x348a6b,_0xae09e2,_0x45dad1);return _0x463de0;},'assessmentData':async _0x5beea6=>{const _0x4cf1fb=await uploadAssessmentData(this['BASE_URL'],_0x5beea6);return _0x4cf1fb;},'deptFaculty':async _0x4452ab=>{const _0x1f8488=await uploadDeptFaculty(this['BASE_URL'],_0x4452ab);return _0x1f8488;}};}}
|
|
37
37
|
|
|
38
38
|
export { Client as default };
|