Index: /trunk/ippScripts/scripts/nightly_science.pl
===================================================================
--- /trunk/ippScripts/scripts/nightly_science.pl	(revision 42295)
+++ /trunk/ippScripts/scripts/nightly_science.pl	(revision 42296)
@@ -1567,4 +1567,5 @@
         # Each comment should only appear once. Therefore, if we see it more than once, we assume the first is extra.
         my %comment_hash = ();
+        my $Nbad = 0;
         foreach my $this_warp (@{ $warps }) {
             my $this_comment = ${ $this_warp }[3];
@@ -1573,7 +1574,8 @@
             my $this_state   = ${ $this_warp }[4];
             my $this_warp_id  = ${ $this_warp }[1];
+	    
+	    #find exposures for this object that have not been fully processed
             if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL')) ) {
-                print STDERR "diff_queue: excluding $this_object from making diffs due to exposure $this_exp_id not being processed to warp stage\n";
-                next;
+                Nbad += 1;
             }
 
@@ -1585,4 +1587,11 @@
             }
         }
+
+        #kick object out of diff consideration if it has exposures not fully processed
+        if ($Nbad > 0) {
+            print STDERR "diff_queue: excluding $this_object from making diffs due to not being fully processed to warp stage\n";
+            next;
+        }
+
         # Exclude any warps that are not stored in the comment_hash.
         my @keep_warps = ();
@@ -1766,4 +1775,5 @@
             my %comment_hash = ();
             my %comment_hash_good = ();
+            my $Nbad = 0;
             foreach my $this_warp (@{ $warps }) {
                 my $this_comment = ${ $this_warp }[3];
@@ -1772,4 +1782,11 @@
                 my $this_state   = ${ $this_warp }[4];
                 my $this_fwhm   = ${ $this_warp }[7];
+                my $this_warp_id  = ${ $this_warp }[1];
+
+	        #find exposures for this object that have not been fully processed
+                if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL')) ) {
+                    Nbad += 1;
+                }
+
                 if (($this_quality != 0) || ($this_state eq 'drop') || ($this_fwhm > $maxFWHM)) {
                     print STDERR "desp_diff_singles: excluding $this_exp_id for $this_object due to non-zero cam.quality $this_quality or state $this_state or FWHM $this_fwhm\n";
@@ -1783,4 +1800,10 @@
                     $comment_hash{$this_comment} = $this_exp_id;
                 }
+            }
+
+            #kick object out of diff consideration if it has exposures not fully processed
+            if ($Nbad > 0) {
+                print STDERR "desp_diff_singles: excluding $this_object from making diffs due to not being fully processed to warp stage\n";
+                next;
             }
 
@@ -2138,4 +2161,5 @@
             my %comment_hash = ();
             my %comment_hash_good = ();
+            my $Nbad = 0;
             foreach my $this_warp (@{ $warps }) {
                 my $this_comment = ${ $this_warp }[3];
@@ -2144,4 +2168,11 @@
                 my $this_state   = ${ $this_warp }[4];
                 my $this_fwhm    = ${ $this_warp }[7];
+                my $this_warp_id  = ${ $this_warp }[1];
+
+	     	#find exposures for this object that have not been fully processed
+             	if (($this_warp_id eq 'NULL') && (($this_quality == 0) || ($this_quality eq 'NULL')) ) {
+             	    Nbad += 1;
+             	}
+
                 if (($this_quality != 0) || ($this_state eq 'drop') || ($this_fwhm > $maxFWHM)) {
                     print STDERR "desp_diff_queue: excluding $this_exp_id for $this_object due to non-zero cam.quality $this_quality or state $this_state or FWHM $this_fwhm\n";
@@ -2155,4 +2186,10 @@
                     $comment_hash{$this_comment} = $this_exp_id;
                 }
+            }
+
+            #kick object out of diff consideration if it has exposures not fully processed
+            if ($Nbad > 0) {
+        	print STDERR "desp_diff_queue: excluding $this_object from making diffs due to not being fully processed to warp stage\n";
+        	next;
             }
 
