-
Notifications
You must be signed in to change notification settings - Fork 0
/
score.html
84 lines (78 loc) · 2.64 KB
/
score.html
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>分数统计</title>
<link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.css">
<style>
h1 {
text-align: center;
font-size: 25px
}
</style>
</head>
<body>
<h1>LDSN.内部SIT演练沙龙得分</h1>
<div class="container row">
<div class="col-xs-8 col-xs-offset-2">
<table class="table table-striped" id="list">
<thead>
<tr>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<script src="http://apps.bdimg.com/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdn1.lncld.net/static/js/av-core-mini-0.5.4.js"></script>
<script>
(function () {
AV.initialize("89jnijh7ho5qm7a4bfgolekx673oof4se568f5y3g9ctudlr", "08rpae5q24x7gll6cwyh1jsbqpam02qx8nn06rjg23pdm76n");
var currentData = AV.Object.extend("Question");
var Score = AV.Object.extend("Score");
var SIT = AV.Object.extend("SIT");
var Group = AV.Object.extend("Group");
var group = [];
var getGroup = new AV.Query(Group);
getGroup.find().then(function(g) {
g.forEach(function (x) {
group.push(x.attributes.group);
})
var getAll = new AV.Query(currentData);
getAll.ascending('title');
return getAll.find();
}).then(function (all) {
var html = '<th>团队</th>';
all.forEach(function (a) {
html += '<th>' + a.attributes.title + '</th>';
});
html += '<th>总分</th>';
$('#list thead tr').html(html);
var getScore = new AV.Query(Score);
getScore.ascending('title');
return getScore.find()
}).then(function (arr) {
var score = [];
arr.forEach(function (s) {
score.push(s.attributes);
})
group.forEach(function (g) {
var cGroup = score.filter(function (x) {
return x.group == g;
});
var html = '<tr><td>' + g + '</td>';
var count = 0;
cGroup.forEach(function (l) {
html += '<td>' + l.score + '</td>';
count += parseInt(l.score);
});
html += '<td>' + count + '</td></tr>';
$('#list tbody').append($(html));
})
});
})();
</script>
</body>
</html>