Skip to content

Commit e4e2921

Browse files
committed
Remove column if no data
1 parent 04ef4ce commit e4e2921

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

site/static/compare.html

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,16 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
348348
</tr>
349349
<tr>
350350
<th>total</th>
351-
<th>{{bootstrapTotals.a.toFixed(3)}}</th>
352-
<th>{{bootstrapTotals.b.toFixed(3)}}</th>
351+
<th v-if="bootstrapTotals.a">A: {{bootstrapTotals.a.toFixed(3)}}</th>
352+
<th v-if="bootstrapTotals.b">B: {{bootstrapTotals.b.toFixed(3)}}</th>
353353
</tr>
354354
<template v-for="bootstrap in bootstraps">
355355
<tr data-field-start="true">
356356
<th style="width: 19em;">{{bootstrap.name}}</th>
357-
<td>{{bootstrap.a}}</td>
358-
<td>{{bootstrap.b}}</td>
359-
<td><span
357+
<td v-if="bootstrap.a">{{bootstrap.a}}</td>
358+
<td v-if="bootstrap.b">{{bootstrap.b}}</td>
359+
<td>
360+
<span v-if="bootstrap.percent"
360361
v-bind:class="percentClass(bootstrap.percent)">{{bootstrap.percent.toFixed(1)}}%</span>
361362
</td>
362363
</tr>
@@ -495,13 +496,13 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
495496
return Object.entries(this.data.a.bootstrap).map(e => {
496497
const name = e[0];
497498

498-
const format = datum => datum.toLocaleString('en-US', { minimumFractionDigits: 3, maximumFractionDigits: 3 });
499-
const a = format(e[1] / 1e9);
500-
const b = format(this.data.b.bootstrap[name] / 1e9);
499+
const format = datum => datum ? datum.toLocaleString('en-US', { minimumFractionDigits: 3, maximumFractionDigits: 3 }) : "";
500+
const a = e[1] / 1e9;
501+
const b = this.data.b.bootstrap[name] / 1e9;
501502
return {
502503
name,
503-
a,
504-
b,
504+
a: format(a),
505+
b: format(b),
505506
percent: 100 * (b - a) / a
506507
};
507508
}).sort((a, b) => Math.abs(b.percent) - Math.abs(a.percent));

0 commit comments

Comments
 (0)