Order bulk extracts in API by date descending
This commit is contained in:
parent
c0dcea61fe
commit
f0e791297e
@ -19,7 +19,8 @@ async function listDataExtracts(): Promise<DataExtract[]> {
|
||||
const extractRecords = await db.manyOrNone<DataExtractRow>(
|
||||
`SELECT
|
||||
extract_id, extracted_on, extract_path
|
||||
FROM bulk_extracts`
|
||||
FROM bulk_extracts
|
||||
ORDER BY extracted_on DESC`
|
||||
);
|
||||
|
||||
return extractRecords.map(getDataExtractFromRow);
|
||||
|
@ -30,10 +30,7 @@ export default class DataExtracts extends React.Component<{}, DataExtractsState>
|
||||
|
||||
async componentDidMount() {
|
||||
let data = await apiGet('/api/extracts', { jsonReviver: dateReviver});
|
||||
const extracts = (data.extracts as ExtractViewModel[])
|
||||
.sort((a, b) => b.extracted_on.valueOf() - a.extracted_on.valueOf());
|
||||
|
||||
|
||||
const extracts = (data.extracts as ExtractViewModel[]);
|
||||
|
||||
this.setState({ extracts: extracts, latestExtract: extracts[0], previousExtracts: extracts.slice(1) });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user