Index: trunk/ippScripts/scripts/nightly_science.pl
===================================================================
--- trunk/ippScripts/scripts/nightly_science.pl	(revision 30120)
+++ trunk/ippScripts/scripts/nightly_science.pl	(revision 30132)
@@ -1289,7 +1289,10 @@
     my $pretend = shift;
 
+    my $Npotential = 0;
+    my $Nnoexp     = 0;
     foreach my $target (sort (keys %science_config)) {
 	if ($science_config{$target}{DIFFABLE} == 1) {
 	    foreach my $filter (@filter_list) {
+		$Npotential ++;
 		my ($NprocChips,$NprocWarps) = pre_diff_queue($date,$observing_state,$target,$filter);
 # 		if ((!defined($force_diff_count))&&($NprocChips != $NprocWarps)) {
@@ -1301,4 +1304,5 @@
 #                 }
                 if ($NprocChips == 0) {
+		    $Nnoexp ++;
 		    if ($debug == 1) {
 			print STDERR "execute_diffs: Target $target in filter $filter on $date has no exposures.\n";
@@ -1328,4 +1332,8 @@
         }
     }
+    if (($Npotential == $Nnoexp)&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')) {
+	$metadata_out{nsDiffState} = 'FINISHED_DIFFS';
+    }	
+
 }
 
