Skip to content

Commit

Permalink
Fixed the sorting and versioning on the file versions
Browse files Browse the repository at this point in the history
  • Loading branch information
bp-cos committed Dec 6, 2023
1 parent 317eb91 commit 24c59df
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/preprints/-components/preprint-file-render/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export default class PreprintFileRender extends Component<InputArgs> {
@task
@waitFor
private async loadPrimaryFileVersions() {
const primaryFileVersions = (await this.primaryFile.versions).toArray();
const primaryFileVersions = (await this.primaryFile.queryHasMany('versions', {
sort: '-id', 'page[size]': 50,
})).toArray();
this.serializeVersions(primaryFileVersions);
this.primaryFileHasVersions = primaryFileVersions.length > 0;
}
Expand Down
1 change: 1 addition & 0 deletions mirage/factories/file-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default Factory.extend<FileVersionModel>({
id: guid('file - version'),
afterCreate: (fileVersion/* , server: Server */) => {
fileVersion.update({
id : faker.random.number(1000),
size: faker.random.number(1000),
contentType: 'application/octet-stream',
dateCreated: faker.date.past(2, new Date(2018, 0, 0)),
Expand Down
3 changes: 1 addition & 2 deletions mirage/factories/preprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ export default Factory.extend<PreprintMirageModel & PreprintTraits>({
delete: 'http://localhost:4200/assets/osf-assets/mfr-test.pdf',
html: 'http://localhost:4200/assets/osf-assets/mfr-test.pdf',
upload: 'http://localhost:4200/assets/osf-assets/mfr-test.pdf',
// download: 'http://localhost:4200/assets/osf-assets/mfr-test.pdf',
download: 'http://localhost:4200/assets/osf-assets/amazon.png',
download: 'http://localhost:4200/assets/osf-assets/mfr-test.pdf',
},
});

Expand Down

0 comments on commit 24c59df

Please sign in to comment.