Index: /trunk/ippScripts/scripts/nightly_science.pl
===================================================================
--- /trunk/ippScripts/scripts/nightly_science.pl	(revision 42315)
+++ /trunk/ippScripts/scripts/nightly_science.pl	(revision 42316)
@@ -1557,5 +1557,5 @@
         my $this_object = shift @{ $object_row };       
         my $this_chunk = shift @{ $object_row };
-        my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,chipRun.state FROM ";
+        my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,chipRun.state,camRun.state FROM ";
         $input_sth .=   " rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) LEFT JOIN camProcessedExp USING(cam_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id) ";
         $input_sth .=   " WHERE chipRun.label = '$label' AND chipRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' ";
@@ -1575,8 +1575,12 @@
             my $this_warp_id  = ${ $this_warp }[1];
             my $chip_state   = ${ $this_warp }[6];
+            my $cam_state   = ${ $this_warp }[7];
 	    
 	    #find exposures for this object that have not been fully processed
-            if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL') || ($chip_state eq 'run') ) ) {
-                $Nbad += 1;
+            if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL')) ) {
+            	$Nbad += 1;
+            }
+            if (($chip_state ne 'full') || ($cam_state ne 'full') ) {
+            	$Nbad += 1;
             }
 
@@ -1765,5 +1769,5 @@
             my $this_chunk = shift @{ $object_row };
        
-            my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,substr(comment, 1, position(' ' in comment)),camProcessedExp.fwhm_major,chipRun.state FROM ";
+            my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,substr(comment, 1, position(' ' in comment)),camProcessedExp.fwhm_major,chipRun.state,camRun.state FROM ";
             $input_sth .=   " rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) LEFT JOIN camProcessedExp USING(cam_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id) ";
             $input_sth .=   " WHERE chipRun.label = '$label' AND chipRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' ";
@@ -1785,9 +1789,13 @@
                 my $this_warp_id  = ${ $this_warp }[1];
                 my $chip_state   = ${ $this_warp }[8];
+                my $cam_state   = ${ $this_warp }[9];
 
 	        #find exposures for this object that have not been fully processed
-                if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL') || ($chip_state eq 'run') ) ) {
-                    $Nbad += 1;
-                }
+             	if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL')) ) {
+             	    $Nbad += 1;
+             	}
+             	if (($chip_state ne 'full') || ($cam_state ne 'full') ) {
+             	    $Nbad += 1;
+             	}
 
                 if (($this_quality != 0) || ($this_state eq 'drop') || ($this_fwhm > $maxFWHM)) {
@@ -2152,5 +2160,5 @@
             my $this_chunk = shift @{ $object_row };
        
-            my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.qualityy,substr(comment, 1, position(' ' in comment)),camProcessedExp.fwhm_major,chipRun.state FROM ";
+            my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state,camProcessedExp.quality,substr(comment, 1, position(' ' in comment)),camProcessedExp.fwhm_major,chipRun.state,camRun.state FROM ";
             $input_sth .=   " rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) LEFT JOIN camProcessedExp USING(cam_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id) ";
             $input_sth .=   " WHERE chipRun.label = '$label' AND chipRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' ";
@@ -2172,9 +2180,13 @@
                 my $this_warp_id  = ${ $this_warp }[1];
                 my $chip_state   = ${ $this_warp }[8];
+                my $cam_state   = ${ $this_warp }[9];
 
 	     	#find exposures for this object that have not been fully processed
-             	if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL') || ($chip_state eq 'run') ) ) {
+             	if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL')) ) {
              	    $Nbad += 1;
              	}
+                if (($chip_state ne 'full') || ($cam_state ne 'full') ) {
+            	    $Nbad += 1;
+                }
 
                 if (($this_quality != 0) || ($this_state eq 'drop') || ($this_fwhm > $maxFWHM)) {
