diff options
Diffstat (limited to 'scraper/client/common/table.component.js')
| -rw-r--r-- | scraper/client/common/table.component.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/scraper/client/common/table.component.js b/scraper/client/common/table.component.js index 76a1d57c..f9be0669 100644 --- a/scraper/client/common/table.component.js +++ b/scraper/client/common/table.component.js @@ -12,9 +12,12 @@ export function TableObject({ tag, object, order, summary }) { if (object.err) { return <div className='tableObject error'>{tag}{' Error: '}{object.err}</div> } - let objects = Object.keys(object) + let keys = Object.keys(object) if (order) { - const grouped = objects.reduce((a, b) => { + const grouped = keys.reduce((a, b) => { + if (summary && !object[b].trim().length) { + return a + } const index = order.indexOf(b) if (index !== -1) { a.order.push([index, b]) @@ -23,23 +26,23 @@ export function TableObject({ tag, object, order, summary }) { } return a }, { order: [], alpha: [] }) - objects = grouped.order + keys = grouped.order .sort((a, b) => a[0] - b[0]) .map(([i, s]) => s) if (!summary) { - objects = objects + keys = keys // .concat([__HR__]) .concat(grouped.alpha.sort()) } } else { - objects = objects.sort() + keys = keys.sort() } return ( <div> {tag && <h3>{tag}</h3>} <table className={'tableObject ' + tag}> <tbody> - {objects.map((key, i) => ( + {keys.map((key, i) => ( <TableRow key={key + '_' + i} name={key} value={object[key]} /> ))} </tbody> |
