-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.js
60 lines (60 loc) · 1.55 KB
/
code.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var work_place=$("tbody")[0]
var sum=0//总绩点
var points=0//总学分
for(var i=1;i<work_place.children.length;i++){//第一行是表头
var each = work_place.children[i] //获取了table每一横排的实体
var each_point=each.children[4].innerText
var each_grade=each.children[10].innerText
//对数据的筛选操作
if(each.children[1].innerText=="通识教育选修"
||(each.children[1].innerText=="公共基础必修"&&each.children[0].innerText.search("高等数学")==-1&&each.children[0].innerText.search("大学物理")==-1)
||(each.children[1].innerText=="公共必修"&&each.children[0].innerText.search("高等数学")==-1&&each.children[0].innerText.search("大学物理")==-1)
||each.children[1].innerText=="专业教育选修"
||each.children[1].innerText=="公共基础选修"){
continue;
}
else if(each_grade==""){
continue;
}
//else if(each.children[6].innerText=="化学与分子科学学院"){
// continue;
//}
else{
var point = parseFloat(each_point)*getGPA(parseFloat(each_grade))
console.log(each.children[0].innerText+": "+each.children[10].innerText)
sum += parseFloat(point)
points += parseFloat(each_point)
}
}
var result=sum/points //GPA
//GPA换算
function getGPA(point){
if(point>=90){
return 4.0
}
else if(point>=85){
return 3.7
}
else if(point>=82){
return 3.3
}
else if(point>=80){
return 3.0
}
else if(point>=75){
return 2.7
}
else if(point>=72){
return 2.3
}
else if(point>=68){
return 2.0
}
//后续的计数没有做详细对照
else if(point>=64){
return 1.5
}
else{
return 1
}
}