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

--- Comment #39 from Matt Blenkinsop <[email protected]> ---
Created attachment 210670
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210670&action=edit
Bug 42218: Import the Regular usage only

A COUNTER master report (PR, DR, TR and IR) can hold the usage of both
the Regular and the TDM (text and data mining) access method. Koha does
not store the access method, so the rows of one title that differ only
in Access_Method have the same identity. The second row overwrites the
monthly usage of the first, and the yearly usage follows. A SUSHI
request for a master report does not filter the access method, and the
filter defaults to all, so a harvest can also add TDM usage to the
totals. The standard views are preset to Regular and are not affected.

Koha now stores the Regular usage only:
- the SUSHI request for a master report adds access_method=Regular
- the SUSHI response is cleaned of other access methods, for a provider
  that ignores the filter. In release 5 the items with another
  Access_Method are dropped. In release 5.1 the Attribute_Performance
  entries with another Access_Method are dropped, and so is an item
  that has no entry left
- a row of a COUNTER file whose Access_Method is not Regular is not
  imported: it adds no usage object and no monthly usage. A missing or
  empty Access_Method is Regular, in any case
- one warning on the job page gives the number of rows that were not
  imported
- Koha::ERM::EUsage::SushiCounter->is_regular_access_method holds the
  rule for both paths

The totals that an earlier harvest of a master report stored can include
TDM usage. They are not changed: a new harvest of the month replaces
them.

Test plan:
1. Create a usage data provider and upload a Title Master Report (TR)
   CSV that has an Access_Method column and these rows for one month:
   - "Title A", Regular, 5
   - "Title A", TDM, 50
   - "Title B", TDM, 30
   - "Title C", empty Access_Method, 7
2. Open the job of the upload: it has a warning "2 rows with an
   Access_Method other than Regular were not imported"
3. Open the usage data provider, Titles tab: Titles A and C are there,
   Title B is not
4. Check the usage of the month and the year: Title A has 5 and not 55,
   Title C has 7
5. Upload a file with TDM rows only: the job has a warning with the
   number of rows, and no title and no usage is added
6. Upload a Title Report standard view (for example TR_J1): it imports
   as before, with no warning
7. prove -l t/db_dependent/Koha/ERM/EUsage/COUNTER_5/CounterFile.t \
     t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/CounterFile.t \
     t/db_dependent/Koha/ERM/EUsage/COUNTER_5/SushiCounter.t \
     t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/SushiCounter.t \
     t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t

Assisted-by: Sonnet 5.5 (Anthropic)

-- 
You are receiving this mail because:
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