From 9045e623dccab87473c50a08a7ac31bd084062f5 Mon Sep 17 00:00:00 2001
From: Gerhard Gonter <ggonter@gmail.com>
Date: Sat, 10 Jul 2021 08:49:43 +0200
Subject: [PATCH] * show incomplete blocks * block progress status visualizaton
 * last block number updated

---
 eprints1.pl | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/eprints1.pl b/eprints1.pl
index 0f92a20..f5e8c43 100755
--- a/eprints1.pl
+++ b/eprints1.pl
@@ -118,7 +118,7 @@ my $op_mode= 'unknown';
   my $ot2ut_context= 'ot2ut-test'; # TODO: parametrize
 # my $ot2ut_context= 'ot2ut-prod'; # TODO: parametrize
 my $oma_sleep_time= 10;
-my $MAX_BLOCK= 670;
+my $MAX_BLOCK= 680;
 
 my %map_ot2ut_roles=
 (
@@ -5136,6 +5136,8 @@ sub policies_stats
 </tr>
 EOX
 
+  my %incomplete_blocks= ();
+
   for (my $metablock_nr= 0; $metablock_nr <= $#metablocks; $metablock_nr++)
   {
     my $mb_othes= $metablocks[$metablock_nr]->{othes}->{cnt_total};
@@ -5206,8 +5208,23 @@ EOX
         my $c= $block->{$context}->{cnt_ok};
         my $e= $block->{$context}->{cnt_error};
         my $pct= $c*100.0/$b_othes;
-        my $ck1= ($pct == 100.0) ? 'lightgreen' : 'lightblue';
         my $ck2= ($e == 0) ? 'lightgreen' : 'pink';
+        my $ck1;
+
+        if ($pct == 100.0)
+        {
+          $ck1= 'lightgreen'
+        }
+        elsif ($pct >= 100.0)
+        { # uploaded objects which were deleted from othes in the meantime
+          $ck1= 'pink';
+        }
+        else
+        {
+          $ck1= 'lightblue';
+          push (@{$incomplete_blocks{$context}}, $block_nr);
+        }
+
         printf MB ("  <td bgcolor=\"$ck1\">%d</td><td bgcolor=\"$ck1\">%7.4f %%</td><td bgcolor=\"$ck2\">%d</td>\n", $c, $pct, $e);
       }
       print MB "</tr>\n";
@@ -5362,6 +5379,14 @@ EOX
     Util::JSON::write_json_file('stale_uploads.json', \%stale_uploads);
   }
 
+  if (exists ($incomplete_blocks{'test'}))
+  {
+    my $ibt= $incomplete_blocks{'test'};
+    print IDX "<h2>incomplete blocks in context test</h2>\n";
+    print IDX join(' ', @$ibt), "\n";
+  }
+  Util::JSON::write_json_file('incomplete_blocks.json', \%incomplete_blocks);
+
   print IDX "<h2>errors</h2>\n". Dumper(\%cnt_errors);
   print IDX "<h2>warnings</h2>\n". Dumper(\%cnt_warnings);
 
-- 
GitLab