From ecddab314838f4d90e959753acf934d9f27cd8c6 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Tue, 3 Jan 2017 09:11:24 +0100 Subject: [PATCH] finally fixed count with unique_biblionumber --- html.pl | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/html.pl b/html.pl index 10ad3d5..cc7089c 100755 --- a/html.pl +++ b/html.pl @@ -318,7 +318,7 @@ while( my $row = $sth_select_authors->fetchrow_hashref ) { $type_stats->{_count_each_type}->{$type}++; if ( $type =~ m/(edt|trl|com|ctb)/ ) { - push @{ $authors->{$authid}->{_sec}->{ $category } }, $row->{biblionumber}; + push @{ $authors->{$authid}->{__sec}->{ $category } }, $row->{biblionumber}; push @{ $authors->{$authid}->{$type}->{ $category } }, $row->{biblionumber}; $type =~ s/(com|ctb)/_ostalo/; push @{ $authors->{$authid}->{$type}->{ $category } }, $row->{biblionumber}; @@ -433,14 +433,21 @@ sub author_html { } } +my @toc_type_label = ( +'aut' => 'Primarno autorstvo', +'edt' => 'UredniÅ¡tva', +'trl' => 'Prijevodi', +'_ostalo' => 'Ostalo', +); + sub count_author_years { my $years = shift; my ($authid) = @_; foreach my $type ( keys %{ $authors->{$authid} } ) { + next if $type =~ m/^_/; foreach my $category ( keys %{ $authors->{$authid}->{$type} } ) { - next if $category =~ m/^_/; - foreach my $biblionumber ( @{ $authors->{$authid}->{$type}->{$category} } ) { + foreach my $biblionumber ( unique_biblionumber @{ $authors->{$authid}->{$type}->{$category} } ) { $years->{ $biblio_year->{ $biblionumber } }->{ $type . '-' . $category }++; } } @@ -448,17 +455,12 @@ sub count_author_years { return $years; } -my @toc_type_label = ( -'aut' => 'Primarno autorstvo', -'edt' => 'UredniÅ¡tva', -'trl' => 'Prijevodi', -'_ostalo' => 'Ostalo', -); - sub html_year_selection { my $fh = shift; my @authids = @_; + debug 'html_year_selection authids=', [ @authids ]; + print $fh qq|Godine:\n|; my $type_cat_count = {}; my $years; @@ -467,6 +469,8 @@ sub html_year_selection { $years = count_author_years( $years, $authid ); } + debug 'years' => $years; + foreach my $year ( sort { $b <=> $a } keys %$years ) { print $fh qq| \n|; foreach my $type_cat ( keys %{ $years->{$year} } ) { @@ -495,6 +499,8 @@ var type_cat_count = |, encode_json($type_cat_count), q|; |; + debug 'type_cat_count' => $type_cat_count; + # TOC print $fh qq|