Skip to content

Commit

Permalink
Sort by publication date on Zenodo
Browse files Browse the repository at this point in the history
It's a bit hidden in the Zenodo docs, but it's possible to sort by publication date rather than creation date.

Refs #976, https://help.zenodo.org/guides/search/
  • Loading branch information
thewilkybarkid committed May 30, 2023
1 parent 68db493 commit bd8e257
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion integration/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const appFixtures: Fixtures<AppFixtures, Record<never, never>, PlaywrightTestArg
{
name: 'recent-prereviews',
url: 'http://zenodo.test/api/records/',
query: { communities: 'prereview-reviews', size: 5, sort: 'mostrecent', subtype: 'peerreview' },
query: { communities: 'prereview-reviews', size: 5, sort: '-publication_date', subtype: 'peerreview' },
},
{
body: RecordsC.encode({
Expand Down
2 changes: 1 addition & 1 deletion integration/finding-a-review.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ test('might not load the older reviews in time', async ({ fetch, javaScriptEnabl
{
name: 'recent-prereviews',
url: 'http://zenodo.test/api/records/',
query: { communities: 'prereview-reviews', size: 5, sort: 'mostrecent', subtype: 'peerreview' },
query: { communities: 'prereview-reviews', size: 5, sort: '-publication_date', subtype: 'peerreview' },
},
new Promise(() =>
setTimeout(
Expand Down
4 changes: 2 additions & 2 deletions src/zenodo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const getRecentPrereviewsFromZenodo = flow(
communities: 'prereview-reviews',
page: currentPage.toString(),
size: '5',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
}),
getRecords,
Expand Down Expand Up @@ -107,7 +107,7 @@ export const getPrereviewsFromZenodo = flow(
communities: 'prereview-reviews',
q: `related.identifier:"${toExternalIdentifier(preprint).identifier}"`,
size: '100',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
}),
getRecords,
Expand Down
22 changes: 11 additions & 11 deletions test/zenodo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('getRecentPrereviewsFromZenodo', () => {
communities: 'prereview-reviews',
page,
size: '5',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
},
},
Expand Down Expand Up @@ -235,7 +235,7 @@ describe('getRecentPrereviewsFromZenodo', () => {
communities: 'prereview-reviews',
page: page.toString(),
size: '5',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
}).toString()}` && cache === 'force-cache',
{
Expand All @@ -250,7 +250,7 @@ describe('getRecentPrereviewsFromZenodo', () => {
communities: 'prereview-reviews',
page: page.toString(),
size: '5',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
}).toString()}` && cache === 'no-cache',
{ throws: new Error('Network error') },
Expand Down Expand Up @@ -389,7 +389,7 @@ describe('getRecentPrereviewsFromZenodo', () => {
communities: 'prereview-reviews',
page,
size: '5',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
},
},
Expand Down Expand Up @@ -529,7 +529,7 @@ describe('getRecentPrereviewsFromZenodo', () => {
communities: 'prereview-reviews',
page,
size: '5',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
},
},
Expand Down Expand Up @@ -558,7 +558,7 @@ describe('getRecentPrereviewsFromZenodo', () => {
communities: 'prereview-reviews',
page,
size: '5',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
},
},
Expand Down Expand Up @@ -586,7 +586,7 @@ describe('getRecentPrereviewsFromZenodo', () => {
communities: 'prereview-reviews',
page,
size: '5',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
},
},
Expand Down Expand Up @@ -1297,7 +1297,7 @@ describe('getPrereviewsFromZenodo', () => {
query: {
communities: 'prereview-reviews',
q: `related.identifier:"${_.toExternalIdentifier(preprint).identifier}"`,
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
},
},
Expand Down Expand Up @@ -1372,7 +1372,7 @@ describe('getPrereviewsFromZenodo', () => {
communities: 'prereview-reviews',
q: `related.identifier:"${_.toExternalIdentifier(preprint).identifier}"`,
size: '100',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
}).toString()}` && cache === 'force-cache',
{
Expand All @@ -1387,7 +1387,7 @@ describe('getPrereviewsFromZenodo', () => {
communities: 'prereview-reviews',
q: `related.identifier:"${_.toExternalIdentifier(preprint).identifier}"`,
size: '100',
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
}).toString()}` && cache === 'no-cache',
{ throws: new Error('Network error') },
Expand Down Expand Up @@ -1418,7 +1418,7 @@ describe('getPrereviewsFromZenodo', () => {
query: {
communities: 'prereview-reviews',
q: `related.identifier:"${_.toExternalIdentifier(preprint).identifier}"`,
sort: 'mostrecent',
sort: '-publication_date',
subtype: 'peerreview',
},
},
Expand Down

0 comments on commit bd8e257

Please sign in to comment.