diff --git a/src/components/Papers/PaperGroup.jsx b/src/components/Papers/PaperGroup.jsx index 41c59d74..f04e6baf 100644 --- a/src/components/Papers/PaperGroup.jsx +++ b/src/components/Papers/PaperGroup.jsx @@ -49,7 +49,9 @@ const PaperGroup = () => { return label }) ) - ] + ].sort( + (a, b) => (scannerT(`items.${a}`) > scannerT(`items.${b}`) && 1) || -1 + ) : [] const goPapersList = useCallback( diff --git a/src/helpers/queries.js b/src/helpers/queries.js index e5ebd32e..fd1873e7 100644 --- a/src/helpers/queries.js +++ b/src/helpers/queries.js @@ -18,8 +18,7 @@ export const getAllQualificationLabel = papersDefinitions => { type: 'file', trashed: false }) - .indexFields(['metadata.qualification.label']) - .sortBy([{ 'metadata.qualification.label': 'desc' }]), + .indexFields(['metadata.qualification.label']), options: { as: `getAllQualificationLabel`, fetchPolicy: defaultFetchPolicy @@ -39,8 +38,8 @@ export const getPapersByLabel = label => ({ type: 'file', trashed: false }) - .indexFields(['name', 'metadata.qualification']) - .sortBy([{ name: 'asc' }]), + .indexFields(['created_at', 'metadata.qualification']) + .sortBy([{ created_at: 'desc' }]), options: { as: `getPapersByLabel:${label}`, fetchPolicy: defaultFetchPolicy