Skip to content

Commit 1820fc5

Browse files
fix(getGtfsPlusSpec): Move sorting from GtfsPlusVersionSummary to getGtfsPlusSpec().
1 parent bd14749 commit 1820fc5

File tree

2 files changed

+34
-36
lines changed

2 files changed

+34
-36
lines changed

lib/common/util/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function getGtfsPlusSpec (): Array<GtfsSpecTable> {
3737
const CONFIG: DataToolsConfig = window.DT_CONFIG
3838
const GTFS_PLUS_SPEC = CONFIG.specifications.gtfsplus
3939
if (!GTFS_PLUS_SPEC) throw new Error('GTFS+ yml configuration file is not defined!')
40-
return GTFS_PLUS_SPEC
40+
return GTFS_PLUS_SPEC.sort((table1, table2) => table1.name.localeCompare(table2.name))
4141
}
4242

4343
/**

lib/gtfsplus/components/GtfsPlusVersionSummary.js

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -203,42 +203,40 @@ export default class GtfsPlusVersionSummary extends Component<Props, State> {
203203
</tr>
204204
</thead>
205205
<tbody>
206-
{getGtfsPlusSpec()
207-
.sort((table1, table2) => table1.name.localeCompare(table2.name))
208-
.map((table, index) => {
209-
const issueCount = this.validationIssueCount(table.id)
210-
const tableLevelIssues = this._getTableLevelIssues(table.id)
211-
212-
return (
213-
<tr
214-
rowSpan={tableLevelIssues ? 2 : 1}
215-
key={index}
216-
className={tableLevelIssues
217-
? 'danger'
218-
: +issueCount > 0 && 'warning'
206+
{getGtfsPlusSpec().map((table, index) => {
207+
const issueCount = this.validationIssueCount(table.id)
208+
const tableLevelIssues = this._getTableLevelIssues(table.id)
209+
210+
return (
211+
<tr
212+
rowSpan={tableLevelIssues ? 2 : 1}
213+
key={index}
214+
className={tableLevelIssues
215+
? 'danger'
216+
: +issueCount > 0 && 'warning'
217+
}
218+
style={{ color: this.isTableIncluded(table.id) === 'Yes' ? 'black' : 'lightGray' }}>
219+
<td>
220+
{table.name}
221+
{tableLevelIssues
222+
? <small>
223+
<br />
224+
{tableLevelIssues.length} critical table issue(s):
225+
<ul>
226+
{tableLevelIssues.map((issue, i) =>
227+
<li key={i}>{issue.fieldName}: {issue.description}</li>)}
228+
</ul>
229+
</small>
230+
: null
219231
}
220-
style={{ color: this.isTableIncluded(table.id) === 'Yes' ? 'black' : 'lightGray' }}>
221-
<td>
222-
{table.name}
223-
{tableLevelIssues
224-
? <small>
225-
<br />
226-
{tableLevelIssues.length} critical table issue(s):
227-
<ul>
228-
{tableLevelIssues.map((issue, i) =>
229-
<li key={i}>{issue.fieldName}: {issue.description}</li>)}
230-
</ul>
231-
</small>
232-
: null
233-
}
234-
</td>
235-
<td>{this.isTableIncluded(table.id)}</td>
236-
<td>{this.tableRecordCount(table.id)}</td>
237-
<td>{issueCount}</td>
238-
<td />
239-
</tr>
240-
)
241-
})}
232+
</td>
233+
<td>{this.isTableIncluded(table.id)}</td>
234+
<td>{this.tableRecordCount(table.id)}</td>
235+
<td>{issueCount}</td>
236+
<td />
237+
</tr>
238+
)
239+
})}
242240
</tbody>
243241
</Table>
244242
</Panel>

0 commit comments

Comments
 (0)