https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43617

--- Comment #1 from Thibaud Guillot (thibaud_g) <[email protected]> 
---
Created attachment 206655
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206655&action=edit
Bug 43617: Handle multiple Attribute_Performance entries

Assisted by Sonnet to build unit test

Test plan:

1) Apply the patch

2) Run this one-liner, which builds a COUNTER 5.1 CSV report the same
   way Koha does when harvesting via SUSHI, from a JSON response
   modeling a real-world case: a Platform Report where one platform
   ("nature.com") reports both Searches_Platform and Total_Item_Requests
   via two Attribute_Performance entries, and another ("Springer Nature
   Link") reports Total_Item_Requests spread across three content types
   (Journal, Book, Reference_Work) via three Attribute_Performance
   entries:

   perl -Ilib -e '
   use Modern::Perl;
   use JSON qw( decode_json );
   use File::Slurp;
   use Koha::ERM::EUsage::SushiCounter;
   my $data = decode_json(read_file(
       "t/db_dependent/data/erm/eusage/COUNTER_5.1/PR_P1.json"));
   my $counter = Koha::ERM::EUsage::SushiCounter->new({ response => $data });
   print $counter->get_COUNTER_from_SUSHI;
   '

   Without patch, the body only contains:
     nature.com,Total_Item_Requests,60,10,20,30
   - the Searches_Platform row for nature.com is missing entirely, and
     Total_Item_Requests for Springer Nature Link only reflects the
     Reference_Work entry (60) instead of the sum of all three (111).

   With patch, the body contains:
     nature.com,Searches_Platform,330,100,110,120
     nature.com,Total_Item_Requests,180,50,60,70
     "Springer Nature Link",Total_Item_Requests,111,16,37,58

3) Run the unit tests:
   prove -v t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/SushiCounter.t

Sponsored-by: BibLibre
Assisted-by: Sonnet 5 (Anthropic)

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to