Skip to content
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

OMP category pages show duplicated published items #4411

Closed
Vitaliy-1 opened this issue Jan 31, 2019 · 17 comments
Closed

OMP category pages show duplicated published items #4411

Vitaliy-1 opened this issue Jan 31, 2019 · 17 comments
Assignees
Milestone

Comments

@Vitaliy-1
Copy link
Collaborator

Version: master branch
2 articles in the category but 4 is shown in the order: 1st 2nd 2nd 1st.
https://github.com/pkp/ojs/blob/master/templates/frontend/components/articleList.tpl#L10

@asmecher
Copy link
Member

@NateWr, mind taking a look?

@NateWr
Copy link
Contributor

NateWr commented Feb 4, 2019

articleList.tpl is is re-used in a few places, and the article objects are passed into it. Wherever the article objects are duplicated will come from where the template is invoked. Do you know where that is?

@Vitaliy-1
Copy link
Collaborator Author

In my case, it's coming from this page: https://github.com/pkp/ojs/blob/master/templates/frontend/pages/catalogCategory.tpl that I'm overridden from a theme plugin.

@NateWr
Copy link
Contributor

NateWr commented Feb 5, 2019

@asmecher that looks like it's coming from the new categories stuff. Do you still want me to look into it?

@NateWr
Copy link
Contributor

NateWr commented Feb 7, 2019

This problem exists in OMP too.

@NateWr
Copy link
Contributor

NateWr commented Feb 7, 2019

This seems to have been resolved for OJS with some changes made for #4446. The effective change seems to have been removing usage of articleList.tpl.

However, it still impacts OMP's category page, and nothing jumped out as obviously the cause of it. I'll try to take a look at it.

I'll rename the issue and assign it to 3.2, but if that change doesn't fix things in OJS, please let me know @Vitaliy-1 and I'll take another look.

@NateWr NateWr added this to the OJS/OMP 3.2 milestone Feb 7, 2019
@NateWr NateWr changed the title articleList.tpl: $article array contains duplicated article objects OMP category pages show duplicated published items Feb 7, 2019
@Vitaliy-1
Copy link
Collaborator Author

I'm able to track the problem to PKPSubmissionService::getMany(). Probably the problem with SQL query there: https://github.com/pkp/pkp-lib/blob/master/classes/services/PKPSubmissionService.inc.php#L69
$results already contain duplicates.

@Vitaliy-1
Copy link
Collaborator Author

If using articleList.tpl and OJS master branch several days old.

@NateWr
Copy link
Contributor

NateWr commented Feb 11, 2019

Can you try updating master and see if you still have the problem? I merged something for #4446 just a day before your last comment, so you may not have had that.

@Vitaliy-1
Copy link
Collaborator Author

Just tested with the current master, got the same error.
duplicate_articles

@Vitaliy-1
Copy link
Collaborator Author

I'm getting the following SQL:

select distinct `s`.*, `st`.`setting_value`, `ps`.*, COALESCE(stl.setting_value, stpl.setting_value) AS section_title, COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev from `submissions` as `s` left join `submission_settings` as `st` on `s`.`submission_id` = `st`.`submission_id` left join `published_submissions` as `ps` on `ps`.`submission_id` = `s`.`submission_id` left join `submission_categories` as `sc` on `s`.`submission_id` = `sc`.`submission_id` left join `section_settings` as `stpl` on `s`.`section_id` = stpl.section_id and `stpl`.`setting_name` = 'section_title' and `stpl`.`locale` = 'en_US' left join `section_settings` as `stl` on `s`.`section_id` = stl.section_id and `stl`.`setting_name` = 'section_title' and `stl`.`locale` = 'en_US' left join `section_settings` as `sapl` on `s`.`section_id` = sapl.section_id and `sapl`.`setting_name` = 'section_abbrev' and `sapl`.`locale` = 'en_US' left join `section_settings` as `sal` on `s`.`section_id` = sal.section_id and `sal`.`setting_name` = 'section_abbrev' and `sal`.`locale` = 'en_US' where `s`.`context_id` = '1' and `st`.`setting_name` = 'title' and `ps`.`published_submission_id` is not null and `s`.`status` in ('3') and `sc`.`category_id` in ('1') group by `s`.`submission_id`, `st`.`setting_value`, `ps`.`date_published`, `ps`.`published_submission_id`, COALESCE(stl.setting_value, stpl.setting_value), COALESCE(sal.setting_value, sapl.setting_value) order by `st`.`setting_value` asc

Direct execution gives me:

localhost/ojs-master/		
Showing rows 0 -  3 (4 total, Query took 0.0009 seconds.) [setting_value: ]

submission_id 	locale 	context_id 	section_id 	language 	citations 	date_submitted 	last_modified 	date_status_modified 	status 	submission_progress 	pages 	hide_author 	stage_id 	setting_value    	published_submission_id 	submission_id 	issue_id 	date_published 	seq 	access_status 	section_title 	section_abbrev 	
95	uk_UA	1	10			2017-12-22 17:50:54	2019-02-12 18:31:04	2019-02-12 18:31:03	3	0	e020495	0	5	Methodical recommendations for preparation and defence of a coursework for 6th year student of medico-psychological faculty	78	95	5	2017-12-22 17:58:28	4	0			
96	en_US	1	11			2017-12-27 17:00:38	2019-02-12 18:30:47	2019-02-12 18:30:47	3	0	e020496	0	5	Results of 2017: updated clinical guidelines	79	96	5	2017-12-29 16:17:54	4	0			
95	uk_UA	1	10			2017-12-22 17:50:54	2019-02-12 18:31:04	2019-02-12 18:31:03	3	0	e020495	0	5	Методичні рекомендації до виконання та захисту курсових робіт для студентів 6 курсу медико-психологічного факультету	78	95	5	2017-12-22 17:58:28	4	0			
96	en_US	1	11			2017-12-27 17:00:38	2019-02-12 18:30:47	2019-02-12 18:30:47	3	0	e020496	0	5	Підсумки 2017 року: оновлені клінічні настанови	79	96	5	2017-12-29 16:17:54	4	0			

@Vitaliy-1
Copy link
Collaborator Author

So, probably localizations are not taken into account

@Vitaliy-1
Copy link
Collaborator Author

e.g., when I'm adding:

`st`.`locale` = 'en_US'

just after

`st`.`setting_name` = 'title'

I'm getting:

localhost/ojs-master/		
Showing rows 0 -  1 (2 total, Query took 0.0015 seconds.) [setting_value: ]

submission_id 	locale 	context_id 	section_id 	language 	citations 	date_submitted 	last_modified 	date_status_modified 	status 	submission_progress 	pages 	hide_author 	stage_id 	setting_value    	published_submission_id 	submission_id 	issue_id 	date_published 	seq 	access_status 	section_title 	section_abbrev 	
95	uk_UA	1	10			2017-12-22 17:50:54	2019-02-12 18:31:04	2019-02-12 18:31:03	3	0	e020495	0	5	Methodical recommendations for preparation and defence of a coursework for 6th year student of medico-psychological faculty	78	95	5	2017-12-22 17:58:28	4	0			
96	en_US	1	11			2017-12-27 17:00:38	2019-02-12 18:30:47	2019-02-12 18:30:47	3	0	e020496	0	5	Results of 2017: updated clinical guidelines	79	96	5	2017-12-29 16:17:54	4	0			

That looks more or less normal.

@NateWr
Copy link
Contributor

NateWr commented Feb 13, 2019

Thanks @Vitaliy-1! Re-assigned to 3.1.2. Over to you @asmecher unless you want me to dig into this one. :)

asmecher added a commit to asmecher/pkp-lib that referenced this issue Feb 13, 2019
asmecher added a commit to asmecher/ojs that referenced this issue Feb 13, 2019
@asmecher
Copy link
Member

@NateWr, this was caused by the submission query builder fetching the submission title for sorting purposes without checking the title locale. This will multiply the number of submissions returned by the number of title languages available.

PRs:

Mind taking a look?

@NateWr
Copy link
Contributor

NateWr commented Feb 14, 2019

Looks good. A couple of the mysql tests failed but it didn't look related. I've restarted them, but go ahead whenever you're ready.

Does this need to be cherry-picked to master?

asmecher added a commit that referenced this issue Feb 14, 2019
#4411 Make submission title fetch not multiply by number of languages available
@asmecher
Copy link
Member

Thanks! Cherry-picked forward to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants