-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable.js
85 lines (63 loc) · 2.94 KB
/
table.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
table = {}
function devComp(a, b) {
return (b.karma - a.karma);
}
table.createTable = function()
{
list = [];
for (var developer in developers.list) {
developers.list[developer].login = developer;
list.push(developers.list[developer]);
}
for (var i = 0; i < list.length; i++) {
list[i].karma = (1 - list[i].correctTestCount / list[i].testCount) * 100;
}
list.sort(devComp);
progressbar.remove();
ratingTable = document.createElement("table");
for (var i = 0; i < list.length; i++) {
var line = document.createElement("tr");
var rank = document.createElement("td");
rank.className = "rank";
rank.textContent = (i + 1);
line.appendChild(rank);
var image = document.createElement("img");
image.src = list[i].image;
imageCell = document.createElement("td");
imageCell.appendChild(image);
line.appendChild(imageCell);
var info = document.createElement("td");
info.className = "info";
var linkToProfile = document.createElement("a");
linkToProfile.href = list[i].ref;
linkToProfile.textContent = list[i].login;
linkToProfile.className = "name";
info.appendChild(linkToProfile);
var karma = document.createElement("div");
karma.textContent = list[i].karma.toFixed(1) + "% ";
karma.textContent += "(" + (list[i].testCount - list[i].correctTestCount) + " of " + list[i].testCount + " failed)";
info.appendChild(karma);
line.appendChild(info);
list[i].worstTests.sort(devComp);
var worstTestsPercent = document.createElement("td");
var worstTestsLink = document.createElement("td");
worstTestsPercent.className = "percent";
worstTestsPercent.align = "right";
worstTestsLink.className = "links";
for (var j = 0; j < list[i].worstTests.length; j++) {
var currentKarma = document.createElement("div");
currentKarma.textContent = (list[i].worstTests[j].karma * 100).toFixed(1) + "% ";
worstTestsPercent.appendChild(currentKarma);
var currentTest = document.createElement("a");
currentTest.className = "test";
currentTest.textContent = list[i].worstTests[j].builder + "/" + list[i].worstTests[j].name;
currentTest.href = "http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=%40ToT%20Blink&tests=" + list[i].worstTests[j].name;
worstTestsLink.appendChild(currentTest);
worstTestsLink.appendChild(document.createElement("br"));
}
line.appendChild(worstTestsPercent);
line.appendChild(worstTestsLink);
ratingTable.appendChild(line);
}
document.body.appendChild(ratingTable);
}