From f7e2bc5d9bf51350bf325df827988935c0f352e1 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 24 Oct 2023 15:06:59 +0000 Subject: [PATCH] Bug 34587: Move YOP to mus/yus instead of erm_usage_titles Signed-off-by: Jessica Zairo Signed-off-by: Michaela Sieber Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- Koha/ERM/EUsage/CounterFile.pm | 13 ++++++++----- Koha/Schema/Result/ErmUsageMus.pm | 14 ++++++++++++-- Koha/Schema/Result/ErmUsageTitle.pm | 14 ++------------ Koha/Schema/Result/ErmUsageYus.pm | 14 ++++++++++++-- api/v1/swagger/definitions/erm_usage_mus.yaml | 5 +++++ api/v1/swagger/definitions/erm_usage_title.yaml | 5 ----- api/v1/swagger/definitions/erm_usage_yus.yaml | 5 +++++ .../atomicupdate/erm_usage_statistics_tables.pl | 3 ++- installer/data/mysql/kohastructure.sql | 3 ++- 9 files changed, 48 insertions(+), 28 deletions(-) diff --git a/Koha/ERM/EUsage/CounterFile.pm b/Koha/ERM/EUsage/CounterFile.pm index 6ca792e98c..49bf4e9853 100644 --- a/Koha/ERM/EUsage/CounterFile.pm +++ b/Koha/ERM/EUsage/CounterFile.pm @@ -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} ) : (), diff --git a/Koha/Schema/Result/ErmUsageMus.pm b/Koha/Schema/Result/ErmUsageMus.pm index 89de0b49cb..54c257e0b6 100644 --- a/Koha/Schema/Result/ErmUsageMus.pm +++ b/Koha/Schema/Result/ErmUsageMus.pm @@ -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 { diff --git a/Koha/Schema/Result/ErmUsageTitle.pm b/Koha/Schema/Result/ErmUsageTitle.pm index a32d7c4056..0bb84fd429 100644 --- a/Koha/Schema/Result/ErmUsageTitle.pm +++ b/Koha/Schema/Result/ErmUsageTitle.pm @@ -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 { diff --git a/Koha/Schema/Result/ErmUsageYus.pm b/Koha/Schema/Result/ErmUsageYus.pm index e5dccfa8d0..0dbb1c5c48 100644 --- a/Koha/Schema/Result/ErmUsageYus.pm +++ b/Koha/Schema/Result/ErmUsageYus.pm @@ -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 { diff --git a/api/v1/swagger/definitions/erm_usage_mus.yaml b/api/v1/swagger/definitions/erm_usage_mus.yaml index dad31e1c00..6b80649e18 100644 --- a/api/v1/swagger/definitions/erm_usage_mus.yaml +++ b/api/v1/swagger/definitions/erm_usage_mus.yaml @@ -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: diff --git a/api/v1/swagger/definitions/erm_usage_title.yaml b/api/v1/swagger/definitions/erm_usage_title.yaml index 46b5249c9d..7dcd6d42bd 100644 --- a/api/v1/swagger/definitions/erm_usage_title.yaml +++ b/api/v1/swagger/definitions/erm_usage_title.yaml @@ -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: diff --git a/api/v1/swagger/definitions/erm_usage_yus.yaml b/api/v1/swagger/definitions/erm_usage_yus.yaml index 0eb3562798..8056a29be8 100644 --- a/api/v1/swagger/definitions/erm_usage_yus.yaml +++ b/api/v1/swagger/definitions/erm_usage_yus.yaml @@ -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: diff --git a/installer/data/mysql/atomicupdate/erm_usage_statistics_tables.pl b/installer/data/mysql/atomicupdate/erm_usage_statistics_tables.pl index a455e6665f..74792fa10d 100644 --- a/installer/data/mysql/atomicupdate/erm_usage_statistics_tables.pl +++ b/installer/data/mysql/atomicupdate/erm_usage_statistics_tables.pl @@ -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, diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index d085a4615f..64fa14a016 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -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, -- 2.39.5