Skip to content

Commit ab69e8b

Browse files
authored
Merge pull request #42 from mukilan/add-explanation-for-scores
Add explanation for scores
2 parents fc0dcf4 + 88cbea1 commit ab69e8b

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

site/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
#score-table-body .score {
5959
text-align: right;
6060
}
61+
62+
#score-explanation {
63+
padding: 10px;
64+
font-size: 1rem;
65+
}
6166
</style>
6267
</head>
6368
<body>
@@ -103,11 +108,24 @@
103108
<div class="row hide-in-embed">
104109
<table class="col-12" id="score-table">
105110
<thead id="score-table-header">
111+
<tr>
112+
<th>Test Suite</th>
113+
<th>Score</th>
114+
</tr>
106115
</thead>
107116
<tbody id="score-table-body">
108117
</tbody>
109118
</table>
110119
</div>
120+
<div class="row hide-in-embed" id="score-explanation">
121+
Scores are calculated as percentages of total <b>enabled</b>
122+
tests within the suite that pass. A passing test with no
123+
subtests gets a score of 1 while a test with subtests gets a
124+
score between 0 and 1 representing the fraction of passing
125+
subtests within that test. This is different from the
126+
percentages on wpt.fyi which is calculated by giving equal
127+
weight to both top-level tests and subtests.
128+
</div>
111129
</div>
112130
</body>
113131
</html>

site/load-chart.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,6 @@ function setupChart () {
162162
const score_table = document.getElementById('score-table-body')
163163
removeChildren(score_table)
164164

165-
removeChildren(document.getElementById('score-table-header'))
166-
.insertAdjacentHTML(
167-
'beforeend',
168-
`<tr>
169-
<th>Test Suite</th>
170-
<th>Servo</th>
171-
</tr>`
172-
)
173-
174165
for (const [idx, area] of scores.area_keys.entries()) {
175166
const recent_score = scores.scores[scores.scores.length - 1]
176167
score_table.insertAdjacentHTML(
@@ -200,15 +191,13 @@ function setupChart () {
200191
area_dropdown.appendChild(selector)
201192
}
202193

203-
function update () {
204-
update_table(scores)
205-
update_chart()
206-
}
194+
update_chart()
207195

208-
area_dropdown.onchange = update
209-
period_dropdown.onchange = update
196+
area_dropdown.onchange = update_chart
197+
period_dropdown.onchange = update_chart
210198
area_dropdown.value = scores.area_keys[0]
211199
period_dropdown.value = Object.keys(periodRanges)[4]
212-
update()
200+
update_table(scores)
201+
update_chart()
213202
})
214203
}

0 commit comments

Comments
 (0)