diff --git a/eprints1.pl b/eprints1.pl index f3378641e5e1d08e130b87ec7406c23342bd6522..59be59a14124a5dd7d493bdf7982fc462be80956 100755 --- a/eprints1.pl +++ b/eprints1.pl @@ -4756,9 +4756,10 @@ sub policies_stats if ($context eq 'ot2ut-test') { $context= 'test'; } elsif ($context eq 'ot2ut-entw') { $context= 'entw'; } elsif ($context eq 'ot2ut-prod') { $context= 'prod'; } - # else ... this should not happen + elsif ($context =~ /deleted/) {} # ignore + else { die ("invalid context $context"); } # ... this should not happen, unless someone writes an undefined context into the sync collection - my $block_nr= int($eprint_id/100); + my $block_nr= int($eprint_id/100); my $metablock_nr= int($block_nr/100); $totals{$context}->{cnt_total}++; $blocks[$block_nr]->{$context}->{cnt_total}++; @@ -4816,13 +4817,13 @@ sub policies_stats map { $row_utp->{$_} } qw(eprint_id eprint_status date_sperre einverstaendnis lastmod full_text_status sperre cnt_errors cnt_warnings errors warnings docs ut_public urn doi ac_nummer); $eprint_id += 0; - my $block_nr= int($eprint_id/100); + my $block_nr= int($eprint_id/100); my $metablock_nr= int($block_nr/100); $totals{othes}->{cnt_total}++; $blocks[$block_nr]->{othes}->{cnt_total}++; $metablocks[$metablock_nr]->{othes}->{cnt_total}++; - $eprint_ids[$eprint_id]->{othes}= 1; + $eprint_ids[$eprint_id]->{othes}= $lastmod; my ($cnt_docs, $cnt_public, $cnt_restricted, $cnt_embargo)= map { $docs->{$_} } qw(cnt_docs cnt_public cnt_restricted cnt_embargo); @@ -4926,7 +4927,7 @@ sub policies_stats } # print __LINE__, " working: cctab: ", Dumper($cctab); - # BEGIN annotations + { # BEGIN annotations my @s1= qw(archive FALSE FALSE no restricted 1 1 0 0 no); push (@s1, qw(0 0 0 0 1)) if ($flag_add_utheses_policies); push (@s1, qw(present NULL)) if ($flag_add_identifiers); @@ -5077,7 +5078,7 @@ sub policies_stats $b6c->{annotation}= { bgcolor => 'pink', note => 'Volltext restricted, kein Embargo' }; # print __LINE__, " special bucket found: ", Dumper($b6b); } - # END annotations + } # END annotations my $bucket_cnt= $cctab->show_tsv(['othes', @contexts], 'counters.tsv'); my $now= scalar localtime(time()); @@ -5087,6 +5088,7 @@ sub policies_stats $msg_html= '<p><font color="red">' . $msg . '</font></p>'; } + my %stale_uploads= (); my $idx_html= join('/', $base_path, 'index.html'); open(IDX, '>:utf8', $idx_html); print IDX <<"EOX"; @@ -5196,12 +5198,13 @@ EOX </style> </head> <body> +<p>last refreshed: $now</p> <table border="1"> <tr> - <th width="100px">eprint_id</th> - <th width="100px">entw</th> - <th width="100px">test</th> - <th width="100px">prod</th> + <th x_width="100px" colspan="2" width="25%">eprint_id</th> + <th x_width="100px" colspan="2" width="25%">entw</th> + <th x_width="100px" colspan="2" width="25%">test</th> + <th x_width="100px" colspan="2" width="25%">prod</th> </tr> EOX @@ -5213,18 +5216,24 @@ EOX my $x= $eprint_ids[$eprint_id]; next unless (defined ($x)); - print BLOCK "<tr>\n <td><a href=\"https://othes.univie.ac.at/$eprint_id/\" target=\"othes\">$eprint_id</a></td>\n"; + my $lastmod= $x->{othes}; + print BLOCK <<EOX; +<tr> + <td><a href="https://othes.univie.ac.at/$eprint_id/" target="othes">$eprint_id</a> + <td>$lastmod</td> +</td> +EOX foreach my $context (qw(entw test prod)) { unless (exists ($x->{$context})) { - print BLOCK " <td> </td>\n"; + print BLOCK " <td> </td><td> </td>\n"; next; } my $c= $x->{$context}; - my ($error_code, $utheses_id, $errors)= map { $c->{$_} } qw(error_code utheses_id errors); + my ($error_code, $utheses_id, $errors, $ts_upload)= map { $c->{$_} } qw(error_code utheses_id errors ts_upload); if ($error_code eq 'ok') { my $link; @@ -5234,11 +5243,16 @@ EOX # elsif ($context eq 'prod') { $link= 'https://utheses-admin-ui-utheses-prod.cprod.univie.ac.at/client#/view/document/utheses/' . $utheses_id . '/'; } elsif ($context eq 'prod') { $link= 'https://utheses-admin-ui-utheses-prod.cprod.univie.ac.at/client#/detail/' . $utheses_id . '/'; } - print BLOCK " <td bgcolor=\"lightgreen\"><a href=\"$link\" target=\"$context\">$utheses_id</a></td>\n"; + my $ts_color= 'lightgreen'; + if ($ts_upload lt $lastmod) { $ts_color= 'lightpink'; push (@{$stale_uploads{$context}}, $eprint_id); } + print BLOCK <<EOX; + <td bgcolor="lightgreen"><a href="$link" target="$context">$utheses_id</a></td> + <td bgcolor="$ts_color">$ts_upload</td> +EOX } else { - print BLOCK " <td bgcolor=\"lightpink\">$error_code ", Dumper($errors), "</td>\n"; + print BLOCK " <td bgcolor=\"lightpink\">$error_code ", Dumper($errors), "</td><td>$ts_upload</td>\n"; } } print BLOCK "</tr>\n"; @@ -5262,6 +5276,7 @@ EOX } + # print summaries my $total_othes= $totals{othes}->{cnt_total}; print IDX "<tr>\n <td>total</td>\n <td>", $total_othes, "</td>\n"; foreach my $context (qw(entw test prod)) @@ -5276,7 +5291,34 @@ EOX print IDX "</tr>\n"; print IDX "</table>\n"; + + # print statistics # print __LINE__, " cctab: ", Dumper($cctab); + + my @stale_contexts= sort keys %stale_uploads; + if (@stale_contexts) + { + print IDX "<h2>stale uploads</h2>\n"; + my $last_block; + foreach my $ctx (@stale_contexts) + { + my $stu= $stale_uploads{$ctx}; + print IDX "<h3>stale uploads context $ctx</h3>\n"; + foreach my $eprint_id (@$stu) + { + my $block= int($eprint_id/100); + if ($block != $last_block) + { + print IDX "</p>\n" if (defined ($last_block)); + print IDX "<p><b><a href=\"block_${block}.html\" target=\"blocks\">Block $block</a></b>:"; + $last_block= $block; + } + print IDX ' ', $eprint_id; + } + print IDX "</p>\n" if (defined ($last_block)); + } + } + print IDX "<h2>errors</h2>\n". Dumper(\%cnt_errors); print IDX "<h2>warnings</h2>\n". Dumper(\%cnt_warnings);