File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,8 @@ function setupChart () {
117
117
118
118
function update_chart ( ) {
119
119
if ( ! all_scores ) throw new Error ( 'scores not loaded' )
120
- const chosen_area = area_dropdown . value
120
+ const area_index = + area_dropdown . value
121
121
const chosen_period = period_dropdown . value
122
- const area_index = all_scores . area_keys . indexOf ( chosen_area )
123
122
const table = new google . visualization . DataTable ( )
124
123
options . series = [ ]
125
124
const monthsToSubtract = periodRanges [ chosen_period ]
@@ -164,10 +163,10 @@ function setupChart () {
164
163
options . hAxis . format = 'MMM YYYY'
165
164
}
166
165
167
- for ( const area of scores . area_keys ) {
166
+ for ( const [ index , area ] of scores . focus_areas . entries ( ) ) {
168
167
const selector = document . createElement ( 'option' )
169
- selector . value = area
170
- selector . textContent = scores . focus_areas [ area ]
168
+ selector . value = index
169
+ selector . textContent = area
171
170
area_dropdown . appendChild ( selector )
172
171
}
173
172
@@ -193,7 +192,7 @@ function setupChart () {
193
192
update_chart ( )
194
193
} )
195
194
}
196
- area_dropdown . value = scores . area_keys [ 0 ]
195
+ area_dropdown . value = 0
197
196
period_dropdown . value = Object . keys ( periodRanges ) [ 4 ]
198
197
update_chart ( )
199
198
} )
Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ function update_table (scores) {
13
13
const score_table = document . getElementById ( 'score-table-body' )
14
14
removeChildren ( score_table )
15
15
16
- for ( const [ idx , area ] of scores . area_keys . entries ( ) ) {
16
+ for ( const [ idx , area ] of scores . focus_areas . entries ( ) ) {
17
17
const area_score = scores . scores_last_run [ idx + AREA_SCORE_OFFSET ]
18
18
const score = Math . floor ( 1000 * area_score . total_score / area_score . total_tests ) / 10
19
19
const subtests = Math . floor ( 1000 * area_score . total_subtests_passed / area_score . total_subtests ) / 10
20
20
score_table . insertAdjacentHTML (
21
21
'beforeend' ,
22
22
`<tr class="${ idx % 2 ? 'odd' : 'even' } ">
23
- <td>${ scores . focus_areas [ area ] } </td>
23
+ <td>${ area } </td>
24
24
<td class="score">${ String ( score ) . padEnd ( 4 , '.0' ) } %</td>
25
25
<td class="score">(${ new Intl . NumberFormat ( ) . format ( area_score . total_subtests_passed ) } /${ new Intl . NumberFormat ( ) . format ( area_score . total_subtests ) } ) ${ String ( subtests ) . padEnd ( 4 , '.0' ) } %</td>
26
26
</tr>`
You can’t perform that action at this time.
0 commit comments