Created
May 3, 2017 16:26
-
-
Save JasonQSY/a4a5b6959a967783010540ae1c906125 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// open http://coursesel.umji.sjtu.edu.cn/tpm/findAll_LessonTaskStudent.action | |
// and paste the code on DeveloperTools - Console | |
let data = JSON.parse(document.documentElement.innerText)['data']; | |
let elected = {}; | |
for (let datum of data) { | |
let course = datum['courseName']+datum['courseShortName']; | |
let student = datum['studentName']; | |
let section = datum['lessonTaskId']; | |
if (course in elected) { | |
if (section in elected[course]) { | |
elected[course][section].push(student); | |
} else { | |
elected[course][section] = [student]; | |
} | |
} else { | |
elected[course] = {}; | |
elected[course][section] = [student]; | |
} | |
} | |
document.write(JSON.stringify(elected, null, 2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment