Bug 34587: Move YOP to mus/yus instead of erm_usage_titles

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Pedro Amorim 2023-10-24 15:06:59 +00:00 committed by Tomas Cohen Arazi
parent 7e8f41cce9
commit f7e2bc5d9b
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
9 changed files with 48 additions and 28 deletions

View File

@ -133,9 +133,9 @@ sub _add_usage_objects {
if $self->{job_callbacks};
foreach my $row ( @{$rows} ) {
try {
# INFO: A single row may have multiple instances in the COUNTER report, one for each metric_type or access_type
# INFO: A single row may have multiple instances in the COUNTER report, one for each metric_type or access_type or yop
# If we're on a row that we've already gone through, use the same usage object
# and add usage statistics for the different metric_type or access_type
# and add usage statistics for the different metric_type or access_type or yop
if ( $self->_is_same_usage_object( $previous_object, $row ) ) {
$usage_object = $previous_object;
} else {
@ -239,6 +239,9 @@ sub _add_monthly_usage_entries {
grep ( /Access_Type/, @{$specific_fields} )
? ( access_type => $row->{Access_Type} )
: (),
grep ( /YOP/, @{$specific_fields} )
? ( yop => $row->{YOP} )
: (),
report_type => $self->type
}
],
@ -275,6 +278,9 @@ sub _add_yearly_usage_entries {
grep ( /Access_Type/, @{$specific_fields} )
? ( access_type => $row->{Access_Type} )
: (),
grep ( /YOP/, @{$specific_fields} )
? ( yop => $row->{YOP} )
: (),
report_type => $self->type
}
],
@ -635,9 +641,6 @@ sub _add_usage_object_entry {
title_uri => $row->{URI},
publisher => $row->{Publisher},
publisher_id => $row->{Publisher_ID},
grep ( /YOP/, @{$specific_fields} )
? ( yop => $row->{YOP} )
: (),
grep ( /ISBN/, @{$specific_fields} )
? ( isbn => $row->{ISBN} )
: (),

View File

@ -108,6 +108,14 @@ metric type for the usage statistic
access type for the usage statistic
=head2 yop
data_type: 'varchar'
is_nullable: 1
size: 255
year of publication for the usage statistic
=head2 report_type
data_type: 'varchar'
@ -141,6 +149,8 @@ __PACKAGE__->add_columns(
{ data_type => "varchar", is_nullable => 1, size => 50 },
"access_type",
{ data_type => "varchar", is_nullable => 1, size => 50 },
"yop",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"report_type",
{ data_type => "varchar", is_nullable => 1, size => 50 },
);
@ -260,8 +270,8 @@ __PACKAGE__->belongs_to(
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-08-02 15:57:07
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MY7HLGZQmotzgmOkz2OWWg
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-10-24 15:06:07
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4BXk0QleJJOQVdWh9YQYWA
sub koha_object_class {

View File

@ -110,14 +110,6 @@ Publisher for the title
Publisher ID for the title
=head2 yop
data_type: 'varchar'
is_nullable: 1
size: 255
year of publication of the title
=head2 isbn
data_type: 'varchar'
@ -151,8 +143,6 @@ __PACKAGE__->add_columns(
{ data_type => "varchar", is_nullable => 1, size => 255 },
"publisher_id",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"yop",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"isbn",
{ data_type => "varchar", is_nullable => 1, size => 255 },
);
@ -217,8 +207,8 @@ __PACKAGE__->belongs_to(
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-10-24 10:15:27
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:V8yMHBVRFQrSm5Vj+V7Y+Q
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-10-24 15:06:07
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2Y2PxWnMTavZYR0ljgZ1lQ
sub koha_object_class {

View File

@ -101,6 +101,14 @@ metric type for the usage statistic
access type for the usage statistic
=head2 yop
data_type: 'varchar'
is_nullable: 1
size: 255
year of publication for the usage statistic
=head2 report_type
data_type: 'varchar'
@ -132,6 +140,8 @@ __PACKAGE__->add_columns(
{ data_type => "varchar", is_nullable => 1, size => 50 },
"access_type",
{ data_type => "varchar", is_nullable => 1, size => 50 },
"yop",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"report_type",
{ data_type => "varchar", is_nullable => 1, size => 50 },
);
@ -251,8 +261,8 @@ __PACKAGE__->belongs_to(
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-08-02 15:57:07
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:B439wdXto/YBcahGqalurg
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-10-24 15:06:07
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EkDx9M0j385DbHo4PVxyiQ
sub koha_object_class {

View File

@ -55,6 +55,11 @@ properties:
type:
- string
- "null"
yop:
description: year of publication of the monthly usage summary
type:
- string
- "null"
report_type:
description: report type of the monthly usage summary
type:

View File

@ -63,11 +63,6 @@ properties:
type:
- string
- "null"
yop:
description: year of publication of the title
type:
- string
- "null"
isbn:
description: isbn of the title
type:

View File

@ -50,6 +50,11 @@ properties:
type:
- string
- "null"
yop:
description: year of publication of the yearly usage summary
type:
- string
- "null"
report_type:
description: report type of the yearly usage summary
type:

View File

@ -96,7 +96,6 @@ return {
`title_uri` varchar(255) DEFAULT NULL COMMENT 'URI number for the title',
`publisher` varchar(255) DEFAULT NULL COMMENT 'Publisher for the title',
`publisher_id` varchar(255) DEFAULT NULL COMMENT 'Publisher ID for the title',
`yop` varchar(255) DEFAULT NULL COMMENT 'year of publication of the title',
`isbn` varchar(255) DEFAULT NULL COMMENT 'ISBN of the title',
PRIMARY KEY (`title_id`),
CONSTRAINT `erm_usage_titles_ibfk_1` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -183,6 +182,7 @@ return {
`usage_count` int(11) DEFAULT NULL COMMENT 'usage count for the title',
`metric_type` varchar(50) DEFAULT NULL COMMENT 'metric type for the usage statistic',
`access_type` varchar(50) DEFAULT NULL COMMENT 'access type for the usage statistic',
`yop` varchar(255) DEFAULT NULL COMMENT 'year of publication for the usage statistic',
`report_type` varchar(50) DEFAULT NULL COMMENT 'report type for the usage statistic',
PRIMARY KEY (`monthly_usage_summary_id`),
CONSTRAINT `erm_usage_mus_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_usage_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
@ -213,6 +213,7 @@ return {
`totalcount` int(11) DEFAULT NULL COMMENT 'usage count for the title',
`metric_type` varchar(50) DEFAULT NULL COMMENT 'metric type for the usage statistic',
`access_type` varchar(50) DEFAULT NULL COMMENT 'access type for the usage statistic',
`yop` varchar(255) DEFAULT NULL COMMENT 'year of publication for the usage statistic',
`report_type` varchar(50) DEFAULT NULL COMMENT 'report type for the usage statistic',
PRIMARY KEY (`yearly_usage_summary_id`),
CONSTRAINT `erm_usage_yus_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_usage_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,

View File

@ -3171,6 +3171,7 @@ CREATE TABLE `erm_usage_mus` (
`usage_count` int(11) DEFAULT NULL COMMENT 'usage count for the title',
`metric_type` varchar(50) DEFAULT NULL COMMENT 'metric type for the usage statistic',
`access_type` varchar(50) DEFAULT NULL COMMENT 'access type for the usage statistic',
`yop` varchar(255) DEFAULT NULL COMMENT 'year of publication for the usage statistic',
`report_type` varchar(50) DEFAULT NULL COMMENT 'report type for the usage statistic',
PRIMARY KEY (`monthly_usage_summary_id`),
CONSTRAINT `erm_usage_mus_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_usage_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
@ -3215,7 +3216,6 @@ CREATE TABLE `erm_usage_titles` (
`title_uri` varchar(255) DEFAULT NULL COMMENT 'URI number for the title',
`publisher` varchar(255) DEFAULT NULL COMMENT 'Publisher for the title',
`publisher_id` varchar(255) DEFAULT NULL COMMENT 'Publisher ID for the title',
`yop` varchar(255) DEFAULT NULL COMMENT 'year of publication of the title',
`isbn` varchar(255) DEFAULT NULL COMMENT 'ISBN of the title',
PRIMARY KEY (`title_id`),
CONSTRAINT `erm_usage_titles_ibfk_1` FOREIGN KEY (`usage_data_provider_id`) REFERENCES `erm_usage_data_providers` (`erm_usage_data_provider_id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -3293,6 +3293,7 @@ CREATE TABLE `erm_usage_yus` (
`totalcount` int(11) DEFAULT NULL COMMENT 'usage count for the title',
`metric_type` varchar(50) DEFAULT NULL COMMENT 'metric type for the usage statistic',
`access_type` varchar(50) DEFAULT NULL COMMENT 'access type for the usage statistic',
`yop` varchar(255) DEFAULT NULL COMMENT 'year of publication for the usage statistic',
`report_type` varchar(50) DEFAULT NULL COMMENT 'report type for the usage statistic',
PRIMARY KEY (`yearly_usage_summary_id`),
CONSTRAINT `erm_usage_yus_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_usage_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,