From bugzilla-daemon@bugs.koha-community.org Thu Feb 3 16:05:14 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] New: Should we prefer iterator.first over calling variable.count to reduce our DB hits Date: Thu, 03 Feb 2022 15:05:13 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5685093214944205893==" --===============5685093214944205893== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3D30017 Bug ID: 30017 Summary: Should we prefer iterator.first over calling variable.count to reduce our DB hits Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Templates Assignee: oleonard@myacpl.org Reporter: martin.renvoize@ptfs-europe.com QA Contact: testopia@bugs.koha-community.org I noticed a pattern recently whereby we often call a count prior to iterating over the resultset: [% IF things.count %] . . . [% FOREACH thing IN things %] [% END %]
[% thing.whatever %]
[% END %] This introduces a count(*) DB call. We could instead use the first iteration = of the iterator to setup the boilerplate and reduce our DB hits. [% FOREACH thing IN things %] [% IF thing.first %] [% END %] [% IF thing.last %]
[% thing.whatever %]
[% END %] [% END %] --=20 You are receiving this mail because: You are watching all bug changes. --===============5685093214944205893==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 3 16:06:07 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer iterator.first over calling variable.count to reduce our DB hits Date: Thu, 03 Feb 2022 15:06:06 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6081782295021368135==" --===============6081782295021368135== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3D30017 --- Comment #1 from Martin Renvoize --- Doh.. it's wouldn'y be 'thing.first' and 'thing.last'.. it would be the speci= al variables.. 'loop.first' and 'loop.last' in the above example. --=20 You are receiving this mail because: You are watching all bug changes. --===============6081782295021368135==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 3 16:06:49 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer iterator.first over calling variable.count to reduce our DB hits Date: Thu, 03 Feb 2022 15:06:48 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3238135357774739537==" --===============3238135357774739537== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30017 Martin Renvoize changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes. --===============3238135357774739537==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 3 16:07:01 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer iterator.first over calling variable.count to reduce our DB hits Date: Thu, 03 Feb 2022 15:07:00 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7598864246504476713==" --===============7598864246504476713== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30017 Martin Renvoize changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes. --===============7598864246504476713==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 3 16:07:11 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer iterator.first over calling variable.count to reduce our DB hits Date: Thu, 03 Feb 2022 15:07:09 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3796480225543880821==" --===============3796480225543880821== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30017 Martin Renvoize changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes. --===============3796480225543880821==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 3 16:07:25 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer iterator.first over calling variable.count to reduce our DB hits Date: Thu, 03 Feb 2022 15:07:24 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1457339174866565146==" --===============1457339174866565146== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30017 Martin Renvoize changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com -- You are receiving this mail because: You are watching all bug changes. --===============1457339174866565146==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 3 16:07:42 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer iterator.first over calling variable.count to reduce our DB hits Date: Thu, 03 Feb 2022 15:07:41 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2814431094203935417==" --===============2814431094203935417== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30017 Martin Renvoize changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=29859 -- You are receiving this mail because: You are watching all bug changes. --===============2814431094203935417==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 3 16:09:36 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer `loop.first` and `loop.last` over calling `variable.count` to reduce our DB hits Date: Thu, 03 Feb 2022 15:09:35 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8098252622816572038==" --===============8098252622816572038== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30017 Martin Renvoize changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Should we prefer |Should we prefer |iterator.first over calling |`loop.first` and |variable.count to reduce |`loop.last` over calling |our DB hits |`variable.count` to reduce | |our DB hits -- You are receiving this mail because: You are watching all bug changes. --===============8098252622816572038==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 3 16:21:01 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer `loop.first` and `loop.last` over calling `variable.count` to reduce our DB hits Date: Thu, 03 Feb 2022 15:20:50 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8790119062346919860==" --===============8790119062346919860== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30017 Martin Renvoize changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=23991 -- You are receiving this mail because: You are watching all bug changes. --===============8790119062346919860==-- From bugzilla-daemon@bugs.koha-community.org Mon Feb 7 03:57:45 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer `loop.first` and `loop.last` over calling `variable.count` to reduce our DB hits Date: Mon, 07 Feb 2022 02:57:44 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6486899452954305647==" --===============6486899452954305647== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30017 David Cook changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #2 from David Cook --- Sounds reasonable to me -- You are receiving this mail because: You are watching all bug changes. --===============6486899452954305647==-- From bugzilla-daemon@bugs.koha-community.org Mon Feb 7 16:48:52 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer `loop.first` and `loop.last` over calling `variable.count` to reduce our DB hits Date: Mon, 07 Feb 2022 15:48:51 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2172677450147539177==" --===============2172677450147539177== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30017 --- Comment #3 from Jonathan Druart --- Sometimes we need to know if there is are least 1 row, to display a title for instance, or actions (check/uncheck all) at the top of the table. We will then end up with 2 patterns. Not a big deal, but worst noting it. Maybe better to have a TT var defined at the top of the template then reused all along? -- You are receiving this mail because: You are watching all bug changes. --===============2172677450147539177==-- From bugzilla-daemon@bugs.koha-community.org Wed Feb 16 12:19:09 2022 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 30017] Should we prefer `loop.first` and `loop.last` over calling `variable.count` to reduce our DB hits Date: Wed, 16 Feb 2022 11:19:09 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0027927482068951298==" --===============0027927482068951298== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30017 Owen Leonard changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |koha-bugs@lists.koha-commun | |ity.org -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug. --===============0027927482068951298==--