-
Notifications
You must be signed in to change notification settings - Fork 462
Author sequence in returned API JSON incorrect #7844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've done some more digging in this and I suspect the reason for this is that the QueryBuillder for authors selects
And joins on the publications table. Doesn't this potentially create two This query is also used when fetching authors for other purposes like when building the author string but the sort clause is table specific:
which is why sorting for authors is fine. It's just when you look at the JSON that there's a problem. |
I also have a similar but not quite the same problem. I'm currently building a plugin for OJS 3.3 and when I use Why am I writing this? Because I think (but not sure currently) with this call fetching the data does go another route. So fixing this may be not only a problem of one function but of (some) more? I think it goes something like this: SubmissionDao->getById() as it inherits from SchemaDAO pkp-lib/classes/db/SchemaDAO.inc.php Line 55 in c77c859
The EDIT: I dug some more and found that it also goes into the PKPAuthorQueryBuilder::getQuery().
For this case changing the * to a.* does fix the problem for me and the correct seq are included into the author-objects (and nothing else is changed inside the whole submission object). BUT: I don't know if this change does affect some other methods so that these don't work correctly anymore but I don't think so. I hope that this comment was helpful to fix the problem. |
Thanks for sharing the additional info and your fix, @JakobRing. Will get this updated. |
Uh oh!
There was an error while loading. Please reload this page.
Update 2025-04-04
PRs:
stable-3_3_0
pkp-lib
: pkp/pkp-lib#7844 Author sequence in returned API JSON incorrect #11230ojs
: pkp/pkp-lib#7844 Author sequence in returned API JSON incorrect ojs#4811omp
: pkp/pkp-lib#7844 Author sequence in returned API JSON incorrect omp#1939ops
: pkp/pkp-lib#7844 Author sequence in returned API JSON incorrect ops#943Describe the bug
The returned JSON when fetching a publication with an API call of the type:
https://journal.org/index.php/path/api/v1/submissions/xxxxx/publications/xxxxx
Includes the wrong sequence for authors. It sets the seq attribute of all of the authors to the sequence the publication has in the issue. Here is a relevant database record showing the sequence of the publication:
And here is the JSON for some of the authors. The author sequence is circled:
I've dumped variables and it seems that this is set this way already, here:
pkp-lib/classes/services/PKPPublicationService.inc.php
Line 171 in 3ffbbe1
Sequence is correctly set in the authors table for the record, and the author string is also correct.
Seen in 3.3.0.8
The text was updated successfully, but these errors were encountered: