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

foreach loop in issueArchive.tpl seems to assume there are no gaps in the issue_id sequence #235

Closed
barnzilla opened this issue Jul 18, 2023 · 0 comments

Comments

@barnzilla
Copy link

barnzilla commented Jul 18, 2023

Describe the bug
I could be wrong but I think the foreach loop in issueArchive.tpl assumes there are no gaps in the issue_id sequence as it iterates through each issue and groups issues by four per row. However, if there is a gap in the issue_id sequence, issues will not be rendered in groups of four per row. In the screenshot below, Vol. 47 No. 1 (2015) has an issue_id of 6 and Vol. 48 No. 1 (2016) has an issue_id of 8, causing the top row to contain only three issues, even though there are additional issues available to fill the row.

To Reproduce
Create multiple issues of a journal with an issue_id sequence that has gaps (e.g., 1, 2, 3, 4, 5, 6, 8, 9, 10, 12).

Expected behavior
Issues should be grouped by four per row.

Screenshots
screenshot

Desktop (please complete the following information):

  • OS: Windows 11 Home
  • Browser: Google Chrome
  • Version: 114.0.5735.199 (Official Build) (64-bit)

Additional context
I have resolved this issue for my implementation of the healthSciences theme by:

  • setting $i to zero outside of the foreach loop,
  • removing the key="i" within the foreach loop, and
  • auto-incrementing $i

This disconnects $i from the issue_id sequence and gives me four issues per row (see screenshot below code chunk).

{assign var="i" value="0"}
{foreach from=$issues item="issue"}
     {if $i % 4 == 0 && $i > 0}
          </div>
          {assign var="open" value=false}
     {/if}
     {if $i % 4 == 0}
          <div class="row justify-content-around">
          {assign var="open" value=true}
     {/if}
     <div class="col-md-3 col-lg-2">
          {include file="frontend/objects/issue_summary.tpl" heading="h2"}
     </div>
     {assign var="i" value={$i}+1}
{/foreach}

screenshot2

@barnzilla barnzilla changed the title foreach loop in issueArchive.tpl assumes seems to assume that there are no gaps in the issue_id sequence foreach loop in issueArchive.tpl seems to assume that there are no gaps in the issue_id sequence Jul 18, 2023
@barnzilla barnzilla changed the title foreach loop in issueArchive.tpl seems to assume that there are no gaps in the issue_id sequence foreach loop in issueArchive.tpl seems to assume there are no gaps in the issue_id sequence Jul 18, 2023
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

2 participants