From d21b167b721e669b03433cc87f4a9ea0ac9fd2f8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 13:13:17 +0000 Subject: [PATCH 1/6] Initial plan From 3d5410e67eb519e291017661f483d1697de24617 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 13:23:42 +0000 Subject: [PATCH 2/6] Add ORCID to author search links in TOC when authors_meta has orcid Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com> --- opac/tests/test_interface_TOC.py | 86 ++++++++++++++++++++++++++++ opac/webapp/templates/issue/toc.html | 27 ++++++--- 2 files changed, 105 insertions(+), 8 deletions(-) diff --git a/opac/tests/test_interface_TOC.py b/opac/tests/test_interface_TOC.py index 246b6d46d..0837e02f8 100644 --- a/opac/tests/test_interface_TOC.py +++ b/opac/tests/test_interface_TOC.py @@ -350,3 +350,89 @@ def test_abstract_links_are_displayed(self): for uri in uris: with self.subTest(uri): self.assertIn(uri, response.data.decode("utf-8")) + + def test_author_search_link_includes_orcid_when_authors_meta_has_orcid(self): + """ + Teste para verificar se o link de busca do autor inclui o orcid + quando o artigo tem authors_meta com orcid. + """ + journal = utils.makeOneJournal() + + with self.client as c: + utils.makeOneCollection() + + issue = utils.makeOneIssue({"journal": journal}) + + _article_data = { + "title": "Article Y", + "issue": issue, + "journal": journal, + "authors": ["Author One", "Author Two"], + "authors_meta": [ + { + "name": "Author One", + "affiliation": "University A", + "orcid": "0000-0002-3430-5422", + }, + { + "name": "Author Two", + "affiliation": "University B", + }, + ], + } + utils.makeOneArticle(_article_data) + + response = c.get( + url_for( + "main.issue_toc", + url_seg=journal.url_segment, + url_seg_issue=issue.url_segment, + ) + ) + + response_data = response.data.decode("utf-8") + + # Author with ORCID should have orcid in the search query + self.assertIn( + "q=au:Author One orcid:0000-0002-3430-5422", + response_data, + ) + # Author without ORCID should not have orcid in the search query + self.assertNotIn( + "orcid:", + response_data.split("Author Two")[1].split("")[0], + ) + self.assertIn("q=au:Author Two", response_data) + + def test_author_search_link_without_orcid_when_no_authors_meta(self): + """ + Teste para verificar se o link de busca do autor funciona sem orcid + quando o artigo não tem authors_meta (fallback para authors). + """ + journal = utils.makeOneJournal() + + with self.client as c: + utils.makeOneCollection() + + issue = utils.makeOneIssue({"journal": journal}) + + _article_data = { + "title": "Article Z", + "issue": issue, + "journal": journal, + "authors": ["Simple Author"], + } + utils.makeOneArticle(_article_data) + + response = c.get( + url_for( + "main.issue_toc", + url_seg=journal.url_segment, + url_seg_issue=issue.url_segment, + ) + ) + + response_data = response.data.decode("utf-8") + + self.assertIn("q=au:Simple Author", response_data) + self.assertNotIn("orcid:", response_data) diff --git a/opac/webapp/templates/issue/toc.html b/opac/webapp/templates/issue/toc.html index dd5694d00..da57b538a 100644 --- a/opac/webapp/templates/issue/toc.html +++ b/opac/webapp/templates/issue/toc.html @@ -208,14 +208,25 @@

{% endif %} - {%- for author in article.authors %} - {% if session.lang %} - {{- author|striptags -}} - {% else %} - {{- author|striptags -}} - {% if not loop.last %};{% endif %} - {% endif %} - {% endfor -%} + {%- if article.authors_meta %} + {%- for author in article.authors_meta %} + {% if session.lang %} + {{- author.name|striptags -}} + {% else %} + {{- author.name|striptags -}} + {% if not loop.last %};{% endif %} + {% endif %} + {% endfor -%} + {%- else %} + {%- for author in article.authors %} + {% if session.lang %} + {{- author|striptags -}} + {% else %} + {{- author|striptags -}} + {% if not loop.last %};{% endif %} + {% endif %} + {% endfor -%} + {%- endif %}