-
Notifications
You must be signed in to change notification settings - Fork 451
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
Logic Error in SQL query invalidates editorial statistics #9132
Comments
@bozana, could you have a look at this one? |
Hi @ronste, good catch! I think the problem is in this line: Could you please check if those missing articles are maybe submitted and published on the same day i.e. how are the submitted and published date of those articles? Could you maybe also test this change and investigate all the stats counts (not only of the published articles) then? |
Hi @bozana , when I try your suggestion, i.e.
I get:
instead of 37 published and 0 imported: And I just did another short test. I created a new empty journal (actually a fresh installation) and created and published a single submission. With the original code the editorial activity shows: With the code you suggested I get: That is certainly better. But the submissions are still counted as If I apply your fix to replace However, i still can't figure out why I only get 25 published submissions for my joural instead of 37. When I run the query in the database, i.e.: select * from `submissions` as `s` left join `publications` as `pi` on
`pi`.`publication_id` = (select `pi2`.`publication_id` from `publications` as `pi2` where
`pi2`.`submission_id` = `s`.`submission_id` and `pi2`.`status` = 3
order by `pi2`.`date_published` asc limit 1) where `s`.`context_id` in (1) and
`s`.`submission_progress` = 0 and
(`pi`.`date_published` is null or DATE(s.date_submitted) >= pi.date_published) and
`pi`.`date_published` > '2021-07-05'; I get the correct number of 37 rows of publications. |
yes, I would then need to apply the changes to those other places in the code 👍 |
what do you get wit this sql:
|
I get an empty set. And I get 4 if I ommit the date range, 8 if I ommit By the way, this is the journal used for this test: https://dedo.ub.uni-siegen.de/index.php/de_do. |
Ah sorry the DATE around was missing, thus:
|
Still an empty set unfortunately. Maybe we can have a call to try these things? Can you send me your number by e-mail? |
start and end date maybe need ' around it:
|
Now its 25 |
This is the SQL executed to get published submissions. How do other 12 submissions from you not fit into it... ? 🤔 |
Yes, the database in total contains 140 submission IDs and 140 publication IDs. |
@ronste, I've just tested the case when an article is submitted, assigned to an already published issue, and then published. The article date published is not the issue's date published, but the current date. I have tested it using the latest release i.e. the current stable_3_3_0 branch. Thus, this is not your case. Maybe QuickSubmitt plugin behaves differently, maybe you can double check that i.e. if your users have used that plugin and entered the date published that way... |
#9132 fix SQL datetime and date comparison for editorial s…
pkp/pkp-lib#9132 submodule update ##bozana/9132-3_4_0##
Hi @bozana , thanks for the discuission of the issue and the fixes! I will have a look at our specific case(s) when I'm back from vacation. This aprticular journal started with OJS 3 but other have an OJS 2 history, so there might be different reasons for the remaining issue. |
@bozana, could you check out this comment? |
#9132 fix SQL datetime and date comparison for editorial s…
pkp/pkp-lib#9132 submodule update ##bozana/9132##
pkp/pkp-lib#9132 submodule update ##bozana/9132-3_3_0##
pkp/pkp-lib#9132 submodule update ##bozana/9132-3_3_0##
pkp/pkp-lib#9132 submodule update ##bozana/9132-3_3_0##
pkp/pkp-lib#9132 submodule update ##bozana/9132-3_4_0##
pkp/pkp-lib#9132 submodule update ##bozana/9132-3_4_0##
pkp/pkp-lib#9132 submodule update ##bozana/9132-3_4_0##
Fixes merged, thus closing... |
Describe the bug
When compiling the number of published submissions for all our journals I recognized differences in the reported OJS stats (editorial stats) as compared to the actual number of publications listed in the frontend. For some journals even zero published submissions are shown.
Some of these differences can be accounted for by the known issues with missing publication dates and imported articles.
However, sticking to one particular case with no imported articles at all, 37 articles listed in the frontend and 0 published submissions reported in editorial stats over the last 2 years, I debugged the code and came across the followling lines intended to exclude imported submissions:
pkp-lib/classes/services/queryBuilders/PKPStatsEditorialQueryBuilder.inc.php
Lines 365 to 371 in 5cad3a1
In line 369 all publications with no publication date are selected, i.e. included in the response instead of excluded as was intended. Changeing line 369 to:
generates the correct number of 37 published articles in the editorial stats backend.
To Reproduce
Steps to reproduce the behavior:
What application are you using?
OJS version 3.3.0-14
Additional Information
Original discussion of this code: #6011
PRs:
Fix1:
The text was updated successfully, but these errors were encountered: