From 90916f5c0700c5ba54435feacfbe40c1c0a6dffb Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 21 Sep 2017 20:22:00 +0200 Subject: [PATCH] modified report for departments by authors --- html.pl | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/html.pl b/html.pl index 3bd0cf2..e9194b3 100755 --- a/html.pl +++ b/html.pl @@ -543,6 +543,7 @@ var type_cat_count = |, encode_json($type_cat_count), q|; } +my $authid_fullname; foreach my $row ( sort { $a->{full_name} cmp $b->{full_name} } @authors ) { @@ -554,6 +555,8 @@ foreach my $row ( sort { $a->{full_name} cmp $b->{full_name} } @authors ) { } print $index qq{
  • }, $row->{full_name}, "
  • \n"; + $authid_fullname->{ $row->{authid} } = $row->{full_name}; + my $path = "html/$row->{authid}"; open(my $fh, '>:encoding(utf-8)', "$path.new"); print $fh html_title($row->{full_name}, "bibliografija"); @@ -580,6 +583,7 @@ rename 'html/index.new', 'html/index.html'; debug 'auth_header' => $auth_header; +debug 'authid_fullname' => $authid_fullname; my $department_category_author; foreach my $department ( sort keys %$auth_department ) { @@ -724,7 +728,7 @@ my @report_labels; my $label; my $sub_labels; -open(my $report, '<:encoding(utf-8)', 'AZVO.txt'); +open(my $report, '<:encoding(utf-8)', 'nAZVO.txt'); while( <$report> ) { chomp; if ( /^([^\t]+)\t+(.+)/ ) { @@ -812,7 +816,7 @@ foreach my $department ( @departments ) { } # group -debug 'table', $table; +#debug 'table', $table; open(my $fh, '>:encoding(utf-8)', 'html/azvo.new'); open(my $fh2, '>:encoding(utf-8)', 'html/azvo2.new'); @@ -855,5 +859,63 @@ close($fh2); rename 'html/azvo.new', 'html/azvo.html'; rename 'html/azvo2.new', 'html/azvo2.html'; +my $dep_au_count; + +foreach my $department ( @departments ) { + foreach my $line ( @report_lines ) { + my $label = $line->[0]; + my @biblionumbers; + foreach ( 1 .. $#$line ) { + my ( $category, $type ) = @{ $line->[ $_ ] }; + + foreach my $authid ( @{ $auth_department->{$department} } ) { + next unless exists $authors->{$authid}->{$type}->{$category}; + my @biblionumbers = @{ $authors->{$authid}->{$type}->{$category} }; + + $dep_au_count->{ $department }->{ $authid }->{ $label } += scalar @biblionumbers; + } + } + } +} + +debug 'dep_au_count', $dep_au_count; + +mkdir 'html/dep_au' unless -d 'html/dep_au'; +open(my $dep_fh, '>', 'html/dep_au/index.new'); +print $dep_fh html_title('Odsjeci Filozofskog fakulteta u Zagrebu'), qq|