Skip to content

Commit

Permalink
fix(getGtfsPlusSpec): Move sorting from GtfsPlusVersionSummary to get…
Browse files Browse the repository at this point in the history
…GtfsPlusSpec().
  • Loading branch information
binh-dam-ibigroup committed Apr 13, 2020
1 parent bd14749 commit 1820fc5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion lib/common/util/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function getGtfsPlusSpec (): Array<GtfsSpecTable> {
const CONFIG: DataToolsConfig = window.DT_CONFIG
const GTFS_PLUS_SPEC = CONFIG.specifications.gtfsplus
if (!GTFS_PLUS_SPEC) throw new Error('GTFS+ yml configuration file is not defined!')
return GTFS_PLUS_SPEC
return GTFS_PLUS_SPEC.sort((table1, table2) => table1.name.localeCompare(table2.name))
}

/**
Expand Down
68 changes: 33 additions & 35 deletions lib/gtfsplus/components/GtfsPlusVersionSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,42 +203,40 @@ export default class GtfsPlusVersionSummary extends Component<Props, State> {
</tr>
</thead>
<tbody>
{getGtfsPlusSpec()
.sort((table1, table2) => table1.name.localeCompare(table2.name))
.map((table, index) => {
const issueCount = this.validationIssueCount(table.id)
const tableLevelIssues = this._getTableLevelIssues(table.id)

return (
<tr
rowSpan={tableLevelIssues ? 2 : 1}
key={index}
className={tableLevelIssues
? 'danger'
: +issueCount > 0 && 'warning'
{getGtfsPlusSpec().map((table, index) => {
const issueCount = this.validationIssueCount(table.id)
const tableLevelIssues = this._getTableLevelIssues(table.id)

return (
<tr
rowSpan={tableLevelIssues ? 2 : 1}
key={index}
className={tableLevelIssues
? 'danger'
: +issueCount > 0 && 'warning'
}
style={{ color: this.isTableIncluded(table.id) === 'Yes' ? 'black' : 'lightGray' }}>
<td>
{table.name}
{tableLevelIssues
? <small>
<br />
{tableLevelIssues.length} critical table issue(s):
<ul>
{tableLevelIssues.map((issue, i) =>
<li key={i}>{issue.fieldName}: {issue.description}</li>)}
</ul>
</small>
: null
}
style={{ color: this.isTableIncluded(table.id) === 'Yes' ? 'black' : 'lightGray' }}>
<td>
{table.name}
{tableLevelIssues
? <small>
<br />
{tableLevelIssues.length} critical table issue(s):
<ul>
{tableLevelIssues.map((issue, i) =>
<li key={i}>{issue.fieldName}: {issue.description}</li>)}
</ul>
</small>
: null
}
</td>
<td>{this.isTableIncluded(table.id)}</td>
<td>{this.tableRecordCount(table.id)}</td>
<td>{issueCount}</td>
<td />
</tr>
)
})}
</td>
<td>{this.isTableIncluded(table.id)}</td>
<td>{this.tableRecordCount(table.id)}</td>
<td>{issueCount}</td>
<td />
</tr>
)
})}
</tbody>
</Table>
</Panel>
Expand Down

0 comments on commit 1820fc5

Please sign in to comment.