Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions opac/webapp/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def journal_detail(url_seg):
sections = []
recent_articles = []

latest_issue = journal.last_issue
latest_issue = utils.fix_journal_last_issue(journal)

if latest_issue:
latest_issue_legend = descriptive_short_format(
Comment on lines +512 to 515
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a regression test for the scenario this change fixes: a Journal with last_issue present but last_issue.url_segment is None should render /j/<acron>/ (and /journal/<acron>/about/) without raising BuildError, and should generate a valid issue_toc link using the derived segment. There are already integration tests for main.journal_detail, so covering this edge case will prevent the error from reappearing.

Copilot uses AI. Check for mistakes.
Expand Down Expand Up @@ -642,7 +642,7 @@ def about_journal(url_seg):

controllers.set_last_issue_and_issue_count(journal)

latest_issue = journal.last_issue
latest_issue = utils.fix_journal_last_issue(journal)

if latest_issue:
latest_issue_legend = descriptive_short_format(
Expand Down
12 changes: 6 additions & 6 deletions opac/webapp/templates/journal/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ <h2 class="scielo__text-title--4">{% trans %}Nossa Missão{% endtrans %}</h2>
</div>

{# last issue #}
{% if journal.last_issue %}
{% if last_issue and last_issue.url_segment %}

<div class="col-12 col-lg-6">

{% if journal.last_issue.cover_url %}
{% if last_issue.cover_url %}
<a href="{{ url_for('.issue_toc', url_seg=journal.url_segment, url_seg_issue=last_issue.url_segment) }}">
<img src="{{ latest_issue.cover_url }}" class="image" alt="{% trans %}Capa do número mais recente{% endtrans %}" /> <!-- a imagem é opcional -->
<img src="{{ last_issue.cover_url }}" class="image" alt="{% trans %}Capa do número mais recente{% endtrans %}" /> <!-- a imagem é opcional -->
</a>
{% endif %}
<span class="text">
Expand Down Expand Up @@ -240,16 +240,16 @@ <h2 class="scielo__text-title--4">{% trans %}Nossa Missão{% endtrans %}</h2>
{# analytics #}

{# last issue #}
{% if journal.last_issue %}
{% if last_issue and last_issue.url_segment %}

<!--
<div class="block lastIssue">
-->
<div class="col-12 col-sm-6">

{% if journal.last_issue.cover_url %}
{% if last_issue.cover_url %}
<a href="{{ url_for('.issue_toc', url_seg=journal.url_segment, url_seg_issue=last_issue.url_segment) }}">
<img src="{{ latest_issue.cover_url }}" class="image" alt="{% trans %}Capa do número mais recente{% endtrans %}" /> <!-- a imagem é opcional -->
<img src="{{ last_issue.cover_url }}" class="image" alt="{% trans %}Capa do número mais recente{% endtrans %}" /> <!-- a imagem é opcional -->
</a>
{% endif %}
<span class="text">
Expand Down
Loading