Bug 21846: Simplify ugly double for loops
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 26 Feb 2019 20:01:41 +0000 (17:01 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 19 Mar 2019 09:59:04 +0000 (09:59 +0000)
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 180781f4748d689674a9f91f546d8e76324e7291)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

t/db_dependent/Tags.t

index 0952e9a..93014bb 100755 (executable)
@@ -89,8 +89,8 @@ subtest 'add_tag_index() tests' => sub {
         '👍'  => 1,
     };
 
-    for my $term ( keys %{ $terms } ) {
-        for (my $i=1; $i <= $terms->{$term}; $i++) {
+    while ( my ( $term, $count ) = each %$terms ) {
+        for  ( 1 .. $count ) {
             C4::Tags::add_tag_approval( $term );
             C4::Tags::add_tag_index( $term, $biblio->biblionumber );
         }