Index: trunk/ippMonitor/czartool/czartool/Gpc1Db.pm
===================================================================
--- trunk/ippMonitor/czartool/czartool/Gpc1Db.pm	(revision 36455)
+++ trunk/ippMonitor/czartool/czartool/Gpc1Db.pm	(revision 36477)
@@ -139,4 +139,9 @@
     my $stateCol =  $table.".state";
 
+    my $extraState = "";
+    if ($state eq 'new') {
+        $extraState = " OR $stateCol = 'update' ";
+    }
+
     my $query =  $self->{_db}->prepare(<<SQL);
     SELECT COUNT(DISTINCT $id) 
@@ -144,5 +149,5 @@
         JOIN $joinTable USING ($id)
         WHERE label LIKE '$label'
-        AND (($faultCol != 0 AND $stateCol = '$state') OR $stateCol = 'failed_revert')
+        AND ($faultCol != 0 AND ($stateCol = '$state' $extraState))
 SQL
     $query->execute;
@@ -208,10 +213,12 @@
     my $query = undef;
 
+    my $joinTable = undef;
+    my $id = undef;
+    if (!getJoinTableAndId($self, $stage, \$joinTable, \$id)) {return -1;}
+
+    # XXX: the "update" page is now obsolete. The standard processing page should now show
+    # counts in new and update state
     if ($state eq "update") {
-
         if ($stage eq "dist") {return 0;}
-        my $joinTable = undef;
-        my $id = undef;
-        if (!getJoinTableAndId($self, $stage, \$joinTable, \$id)) {return -1;}
 
         if ($stage eq "chip" || $stage eq "fake" || $stage eq "warp" || $stage eq "diff" || $stage eq "magicDS") {
@@ -227,23 +234,27 @@
         else {
         
+        }
+
+    }
+    # 'new' stuff really includes 'update' stuff, at least for LAP. This is a hack, but there you go    
+    elsif ($state eq "new") {
+
+        if ($stage eq "chip" || $stage eq "fake" || $stage eq "warp" || $stage eq "diff" || $stage eq "magicDS") {
+            # get count of runs in new state and update state that have components left to update
+            $query = $self->{_db}->prepare(<<SQL);
+            SELECT COUNT(DISTINCT $id)  
+                FROM $table LEFT JOIN $joinTable
+                USING($id)
+                WHERE label LIKE '$label' 
+                AND (state = 'new' OR (state = 'update' AND data_state = 'update'))
+SQL
+        } else {
             $query = $self->{_db}->prepare(<<SQL);
             SELECT COUNT(state)
-                FROM $table JOIN $joinTable 
-                USING($id) 
+                FROM $table
                 WHERE label LIKE '$label'
-                AND state = 'update'; 
+                AND state = 'new'; 
 SQL
         }
-
-    }
-    # 'new' stuff really includes 'update' stuff, at least for LAP. This is a hack, but there you go    
-    elsif ($state eq "new") {
-
-        $query = $self->{_db}->prepare(<<SQL);
-        SELECT COUNT(state)  
-            FROM $table 
-            WHERE label LIKE '$label' 
-            AND (state = 'new' OR state = 'update')
-SQL
     }
     else {
@@ -256,4 +267,6 @@
 SQL
     }
+
+    # print $query->{Statement} . "\n";
 
     $query->execute;
