@@ -792,8 +792,9 @@ private void downloadCourses() {
792
792
" if (!doc.getElementById('studentDetailsList')) {" +
793
793
" return;" +
794
794
" }" +
795
- " var table = doc.getElementById('studentDetailsList').getElementsByTagName('table')[0]; " +
795
+ " var table = doc.getElementById('studentDetailsList').getElementsByTagName('table')[0];" +
796
796
" var headings = table.getElementsByTagName('th');" +
797
+ " var offset = headings[0].innerText.toLowerCase().includes('invoice') ? -1 : 0;" +
797
798
" var courseIndex, creditsIndex, slotVenueIndex, facultyIndex;" +
798
799
" for(var i = 0; i < headings.length; ++i) {" +
799
800
" var heading = headings[i].innerText.toLowerCase();" +
@@ -810,11 +811,11 @@ private void downloadCourses() {
810
811
" var cells = table.getElementsByTagName('td');" +
811
812
" while (courseIndex < cells.length && creditsIndex < cells.length && slotVenueIndex < cells.length && facultyIndex < cells.length) {" +
812
813
" var course = {};" +
813
- " var rawCourse = cells[courseIndex].innerText.replace(/\\ t/g,'').replace(/\\ n/g,' ');" +
814
+ " var rawCourse = cells[courseIndex + offset ].innerText.replace(/\\ t/g,'').replace(/\\ n/g,' ');" +
814
815
" var rawCourseType = rawCourse.split('(').slice(-1)[0].toLowerCase();" +
815
- " var rawCredits = cells[creditsIndex].innerText.replace(/\\ t/g,'').replace(/\\ n/g,' ').trim().split(' ');" +
816
- " var rawSlotVenue = cells[slotVenueIndex].innerText.replace(/\\ t/g,'').replace(/\\ n/g,'').split('-');" +
817
- " var rawFaculty = cells[facultyIndex].innerText.replace(/\\ t/g,'').replace(/\\ n/g,'').split('-');" +
816
+ " var rawCredits = cells[creditsIndex + offset ].innerText.replace(/\\ t/g,'').replace(/\\ n/g,' ').trim().split(' ');" +
817
+ " var rawSlotVenue = cells[slotVenueIndex + offset ].innerText.replace(/\\ t/g,'').replace(/\\ n/g,'').split('-');" +
818
+ " var rawFaculty = cells[facultyIndex + offset ].innerText.replace(/\\ t/g,'').replace(/\\ n/g,'').split('-');" +
818
819
" course.code = rawCourse.split('-')[0].trim();" +
819
820
" course.title = rawCourse.split('-').slice(1).join('-').split('(')[0].trim();" +
820
821
" course.type = (rawCourseType.includes('lab')) ? 'lab' : ((rawCourseType.includes('project')) ? 'project' : 'theory');" +
@@ -823,10 +824,10 @@ private void downloadCourses() {
823
824
" course.venue = rawSlotVenue.slice(1, rawSlotVenue.length).join(' - ').trim();" +
824
825
" course.faculty = rawFaculty[0].trim();" +
825
826
" response.courses.push(course);" +
826
- " courseIndex += headings.length;" +
827
- " creditsIndex += headings.length;" +
828
- " slotVenueIndex += headings.length;" +
829
- " facultyIndex += headings.length;" +
827
+ " courseIndex += headings.length + offset ;" +
828
+ " creditsIndex += headings.length + offset ;" +
829
+ " slotVenueIndex += headings.length + offset ;" +
830
+ " facultyIndex += headings.length + offset ;" +
830
831
" }" +
831
832
" }" +
832
833
"});" +
0 commit comments