<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>A new request with request id 18477 has been created by koha-devel-request@lists.koha-community.org. Short info on the request is : <br><br>Title : Koha-devel Digest, Vol 186, Issue 8<br>Category : <br>Description : <div>Send Koha-devel mailing list submissions to<br>    koha-devel@lists.koha-community.org<br><br>To subscribe or unsubscribe via the World Wide Web, visit<br>    https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>or, via email, send a message with subject or body 'help' to<br>    koha-devel-request@lists.koha-community.org<br><br>You can reach the person managing the list at<br>    koha-devel-owner@lists.koha-community.org<br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of Koha-devel digest..."<br><br><br>Today's Topics:<br><br>   1. Re: TT loop count VS size (dcook@prosentient.com.au)<br>   2. Re: TT loop count VS size (Tomas Cohen Arazi)<br>   3. Re: TT loop count VS size (dcook@prosentient.com.au)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Mon, 10 May 2021 09:50:22 +1000<br>From: <dcook@prosentient.com.au><br>To: "'Jonathan Druart'" <jonathan.druart@bugs.koha-community.org>,<br>    "'Fridolin SOMERS'" <fridolin.somers@biblibre.com><br>Cc: "'koha-devel'" <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] TT loop count VS size<br>Message-ID: <00a601d7452e$135c7ec0$3a157c40$@prosentient.com.au><br>Content-Type: text/plain; charset="utf-8"<br><br>I was going to say… I’d never even heard of the “count” call in TT. Looking at http://template-toolkit.org/docs/manual/VMethods.html, it’s not a method for a data structure. Looking at http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH, it’s only a method of the “loop” variable. <br><br> <br><br>grep -R "loop\.count" *   | wc -l<br><br>86<br><br> <br><br>What’s the actual problem being observed?<br><br> <br><br>David Cook<br><br>Software Engineer<br><br>Prosentient Systems<br><br>Suite 7.03<br><br>6a Glen St<br><br>Milsons Point NSW 2061<br><br>Australia<br><br> <br><br>Office: 02 9212 0899<br><br>Online: 02 8005 0595<br><br> <br><br>From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of Jonathan Druart<br>Sent: Friday, 7 May 2021 5:58 PM<br>To: Fridolin SOMERS <fridolin.somers@biblibre.com><br>Cc: koha-devel <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] TT loop count VS size<br><br> <br><br>You should grep "loop.count", not ".count"<br><br>Most of the count you have with your regex is coming from koha_objects->count<br><br> <br><br>Le ven. 7 mai 2021 à 09:17, Fridolin SOMERS <fridolin.somers@biblibre.com <mailto:fridolin.somers@biblibre.com> > a écrit :<br><br>Hi community,<br><br>I've been on a mindblowing search on a template error :D<br><br>I was thinking that "loop.count" was wrong for testing if loop is not <br>empty, the method is "loop.size".<br><br>See doc <br>http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH<br><br>Looks like we use both actually :<br>  > git grep 'IF.*\.count ' origin/master | wc -l<br>602<br>  > git grep 'IF.*\.size ' origin/master | wc -l<br>1636<br><br>So using count seems to work because it starts with 1.<br>But in my opinion it is a wrong call.<br><br>We can see for example :<br>  <a href="#images">Images ([% localimages.count || 0 | html %])</a><br>This is wrong no ?<br><br>Should be create a coding guideline ?<br><br>-- <br>Fridolin SOMERS <fridolin.somers@biblibre.com <mailto:fridolin.somers@biblibre.com> ><br>Software and system maintainer 🦄<br>BibLibre, France<br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org <mailto:Koha-devel@lists.koha-community.org> <br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/<br>git : https://git.koha-community.org/<br>bugs : https://bugs.koha-community.org/<br><br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20210510/23a000da/attachment-0001.htm><br><br>------------------------------<br><br>Message: 2<br>Date: Sun, 9 May 2021 22:14:06 -0300<br>From: Tomas Cohen Arazi <tomascohen@gmail.com><br>To: David Cook <dcook@prosentient.com.au><br>Cc: Jonathan Druart <jonathan.druart@bugs.koha-community.org>,<br>    Fridolin SOMERS <fridolin.somers@biblibre.com>,  koha-devel<br>    <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] TT loop count VS size<br>Message-ID:<br>    <CABZfb=WowhL3TkMN5zho1DQyaUdZD2NYdcyjxeNvE-JF9ByZ8g@mail.gmail.com><br>Content-Type: text/plain; charset="utf-8"<br><br>That's because .count is a Koha::Objects method.<br><br>El dom., 9 may. 2021 20:50, <dcook@prosentient.com.au> escribió:<br><br>> I was going to say… I’d never even heard of the “count” call in TT.<br>> Looking at http://template-toolkit.org/docs/manual/VMethods.html, it’s<br>> not a method for a data structure. Looking at<br>> http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH,<br>> it’s only a method of the “loop” variable.<br>><br>><br>><br>> grep -R "loop\.count" *   | wc -l<br>><br>> 86<br>><br>><br>><br>> What’s the actual problem being observed?<br>><br>><br>><br>> David Cook<br>><br>> Software Engineer<br>><br>> Prosentient Systems<br>><br>> Suite 7.03<br>><br>> 6a Glen St<br>><br>> Milsons Point NSW 2061<br>><br>> Australia<br>><br>><br>><br>> Office: 02 9212 0899<br>><br>> Online: 02 8005 0595<br>><br>><br>><br>> *From:* Koha-devel <koha-devel-bounces@lists.koha-community.org> *On<br>> Behalf Of *Jonathan Druart<br>> *Sent:* Friday, 7 May 2021 5:58 PM<br>> *To:* Fridolin SOMERS <fridolin.somers@biblibre.com><br>> *Cc:* koha-devel <koha-devel@lists.koha-community.org><br>> *Subject:* Re: [Koha-devel] TT loop count VS size<br>><br>><br>><br>> You should grep "loop.count", not ".count"<br>><br>> Most of the count you have with your regex is coming from<br>> koha_objects->count<br>><br>><br>><br>> Le ven. 7 mai 2021 à 09:17, Fridolin SOMERS <fridolin.somers@biblibre.com><br>> a écrit :<br>><br>> Hi community,<br>><br>> I've been on a mindblowing search on a template error :D<br>><br>> I was thinking that "loop.count" was wrong for testing if loop is not<br>> empty, the method is "loop.size".<br>><br>> See doc<br>> http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH<br>><br>> Looks like we use both actually :<br>>   > git grep 'IF.*\.count ' origin/master | wc -l<br>> 602<br>>   > git grep 'IF.*\.size ' origin/master | wc -l<br>> 1636<br>><br>> So using count seems to work because it starts with 1.<br>> But in my opinion it is a wrong call.<br>><br>> We can see for example :<br>>   <a href="#images">Images ([% localimages.count || 0 | html %])</a><br>> This is wrong no ?<br>><br>> Should be create a coding guideline ?<br>><br>> --<br>> Fridolin SOMERS <fridolin.somers@biblibre.com><br>> Software and system maintainer 🦄<br>> BibLibre, France<br>> _______________________________________________<br>> Koha-devel mailing list<br>> Koha-devel@lists.koha-community.org<br>> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>> website : https://www.koha-community.org/<br>> git : https://git.koha-community.org/<br>> bugs : https://bugs.koha-community.org/<br>><br>> _______________________________________________<br>> Koha-devel mailing list<br>> Koha-devel@lists.koha-community.org<br>> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>> website : https://www.koha-community.org/<br>> git : https://git.koha-community.org/<br>> bugs : https://bugs.koha-community.org/<br>><br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20210509/d89d9722/attachment-0001.htm><br><br>------------------------------<br><br>Message: 3<br>Date: Mon, 10 May 2021 12:20:12 +1000<br>From: <dcook@prosentient.com.au><br>To: "'Tomas Cohen Arazi'" <tomascohen@gmail.com><br>Cc: "'Jonathan Druart'" <jonathan.druart@bugs.koha-community.org>,<br>    "'Fridolin SOMERS'" <fridolin.somers@biblibre.com>, "'koha-devel'"<br>    <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] TT loop count VS size<br>Message-ID: <00c401d74543$018ca980$04a5fc80$@prosentient.com.au><br>Content-Type: text/plain; charset="utf-8"<br><br>I know that .count is an object method, but I don’t understand the problem that Fridolin is having. I don’t see any problem at this point. <br><br> <br><br>David Cook<br><br>Software Engineer<br><br>Prosentient Systems<br><br>Suite 7.03<br><br>6a Glen St<br><br>Milsons Point NSW 2061<br><br>Australia<br><br> <br><br>Office: 02 9212 0899<br><br>Online: 02 8005 0595<br><br> <br><br>From: Tomas Cohen Arazi <tomascohen@gmail.com> <br>Sent: Monday, 10 May 2021 11:14 AM<br>To: David Cook <dcook@prosentient.com.au><br>Cc: Jonathan Druart <jonathan.druart@bugs.koha-community.org>; Fridolin SOMERS <fridolin.somers@biblibre.com>; koha-devel <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] TT loop count VS size<br><br> <br><br>That's because .count is a Koha::Objects method.<br><br> <br><br>El dom., 9 may. 2021 20:50, <dcook@prosentient.com.au <mailto:dcook@prosentient.com.au> > escribió:<br><br>I was going to say… I’d never even heard of the “count” call in TT. Looking at http://template-toolkit.org/docs/manual/VMethods.html, it’s not a method for a data structure. Looking at http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH, it’s only a method of the “loop” variable. <br><br> <br><br>grep -R "loop\.count" *   | wc -l<br><br>86<br><br> <br><br>What’s the actual problem being observed?<br><br> <br><br>David Cook<br><br>Software Engineer<br><br>Prosentient Systems<br><br>Suite 7.03<br><br>6a Glen St<br><br>Milsons Point NSW 2061<br><br>Australia<br><br> <br><br>Office: 02 9212 0899<br><br>Online: 02 8005 0595<br><br> <br><br>From: Koha-devel <koha-devel-bounces@lists.koha-community.org <mailto:koha-devel-bounces@lists.koha-community.org> > On Behalf Of Jonathan Druart<br>Sent: Friday, 7 May 2021 5:58 PM<br>To: Fridolin SOMERS <fridolin.somers@biblibre.com <mailto:fridolin.somers@biblibre.com> ><br>Cc: koha-devel <koha-devel@lists.koha-community.org <mailto:koha-devel@lists.koha-community.org> ><br>Subject: Re: [Koha-devel] TT loop count VS size<br><br> <br><br>You should grep "loop.count", not ".count"<br><br>Most of the count you have with your regex is coming from koha_objects->count<br><br> <br><br>Le ven. 7 mai 2021 à 09:17, Fridolin SOMERS <fridolin.somers@biblibre.com <mailto:fridolin.somers@biblibre.com> > a écrit :<br><br>Hi community,<br><br>I've been on a mindblowing search on a template error :D<br><br>I was thinking that "loop.count" was wrong for testing if loop is not <br>empty, the method is "loop.size".<br><br>See doc <br>http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH<br><br>Looks like we use both actually :<br>  > git grep 'IF.*\.count ' origin/master | wc -l<br>602<br>  > git grep 'IF.*\.size ' origin/master | wc -l<br>1636<br><br>So using count seems to work because it starts with 1.<br>But in my opinion it is a wrong call.<br><br>We can see for example :<br>  <a href="#images">Images ([% localimages.count || 0 | html %])</a><br>This is wrong no ?<br><br>Should be create a coding guideline ?<br><br>-- <br>Fridolin SOMERS <fridolin.somers@biblibre.com><br>Software and system maintainer 🦄<br>BibLibre, France<br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org <mailto:Koha-devel@lists.koha-community.org> <br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/<br>git : https://git.koha-community.org/<br>bugs : https://bugs.koha-community.org/<br><br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org <mailto:Koha-devel@lists.koha-community.org> <br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/<br>git : https://git.koha-community.org/<br>bugs : https://bugs.koha-community.org/<br><br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20210510/91a99f67/attachment.htm><br><br>------------------------------<br><br>Subject: Digest Footer<br><br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/<br>git : https://git.koha-community.org/<br>bugs : https://bugs.koha-community.org/<br><br><br>------------------------------<br><br>End of Koha-devel Digest, Vol 186, Issue 8<br>******************************************<br></div><br><br>NOTE: You are receiving this mail because, the Requester/Technician wanted you to get notified on this request creation.<br></body></html>