33google . charts . load ( 'current' , { packages : [ 'corechart' , 'line' ] } )
44google . charts . setOnLoadCallback ( setupChart )
55
6- const fetchData = fetch ( 'https://wpt.servo.org /scores.json' )
6+ const fetchData = fetch ( '/js /scores.json' )
77const embed = location . search === '?embed'
88let dark_mode = window . matchMedia && window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches
99
@@ -38,7 +38,8 @@ function parseDateString (date) {
3838function toolTip ( date , wpt_sha , servo_version , score , engine ) {
3939 return `
4040 <b>${ formatDate ( date ) } </b></br>
41- Score: <b>${ score / 10 } </b></br>
41+ Score: <b>${ Math . floor ( 100 * score . total_score / score . total_tests ) } %</b></br>
42+ Subtests: <b>${ Math . floor ( 100 * score . total_subtests_passed / score . total_subtests ) } %</b></br>
4243 WPT: ${ wpt_sha } </br>
4344 Servo (${ engine } ): ${ servo_version }
4445 `
@@ -129,7 +130,9 @@ function setupChart () {
129130 table . addColumn ( 'date' , 'runOn' )
130131
131132 options . series . push ( { color : dark_mode ? '#CC9933' : '#3366CC' } )
132- table . addColumn ( 'number' , 'Servo' )
133+ table . addColumn ( 'number' , 'Score' )
134+ table . addColumn ( { type : 'string' , role : 'tooltip' , p : { html : true } } )
135+ table . addColumn ( 'number' , 'Subtests' )
133136 table . addColumn ( { type : 'string' , role : 'tooltip' , p : { html : true } } )
134137
135138 for ( const scores_for_run of all_scores . scores ) {
@@ -141,7 +144,9 @@ function setupChart () {
141144 }
142145 const row = [
143146 date ,
144- area_score / 1000 ,
147+ area_score . total_score / area_score . total_tests ,
148+ toolTip ( date , wpt_sha , browser_version , area_score , 'Servo' ) ,
149+ area_score . total_subtests_passed / area_score . total_subtests ,
145150 toolTip ( date , wpt_sha , browser_version , area_score , 'Servo' )
146151 ]
147152 table . addRow ( row )
@@ -161,12 +166,15 @@ function setupChart () {
161166 removeChildren ( score_table )
162167
163168 for ( const [ idx , area ] of scores . area_keys . entries ( ) ) {
164- const recent_score = scores . scores [ scores . scores . length - 1 ]
169+ const area_score = scores . scores [ scores . scores . length - 1 ] [ idx + AREA_SCORE_OFFSET ]
170+ const score = Math . floor ( 100 * area_score . total_score / area_score . total_tests )
171+ const subtests = Math . floor ( 100 * area_score . total_subtests_passed / area_score . total_subtests )
165172 score_table . insertAdjacentHTML (
166173 'beforeend' ,
167174 `<tr class="${ idx % 2 ? 'odd' : 'even' } ">
168175 <td>${ scores . focus_areas [ area ] } </td>
169- <td class="score">${ String ( recent_score [ idx + AREA_SCORE_OFFSET ] / 10 ) . padEnd ( 4 , '.0' ) } %</td>
176+ <td class="score">${ String ( score ) . padEnd ( 4 , '.0' ) } %</td>
177+ <td class="score">(${ area_score . total_subtests_passed } /${ area_score . total_subtests } ) ${ String ( subtests ) . padEnd ( 4 , '.0' ) } %</td>
170178 </tr>`
171179 )
172180 }
0 commit comments