Index: trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
===================================================================
--- trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 36018)
+++ trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 36042)
@@ -247,5 +247,5 @@
 
     if ($stage eq 'stack_summary') {
-        # stack_summary jobs are so different from others that we lookup in a unique function
+        # stack_summary jobs are so different from others that we lookup in a specialized function
         return lookup_stack_summary($ipprc, $row, $imagedb, $tess_id, $component, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose);
     }
@@ -746,4 +746,6 @@
     $row->{error_code} = $PSTAMP_NO_IMAGE_MATCH;
 
+    $component = '' if $component eq 'all';
+
     my $req_type = $row->{REQ_TYPE};
     my $results;
@@ -753,4 +755,9 @@
         $results = runToolAndParse($command, $verbose);
     } else {
+        my ($release_name, $survey, $default_tess_id) = get_release_info($row);
+        if (!$tess_id and $default_tess_id) {
+            $tess_id = $default_tess_id;
+        }
+
         my $skycells;
         if ($req_type eq 'bycoord') {
@@ -774,9 +781,8 @@
         }
 
-
         if ($skycells) {
             # We have a list of skycells. Find matching projection cells.
-
-            #list of projection_cells that we've included
+            # and then matching rows in stackSummary
+
             my %projection_cells_found;
             foreach my $skycell (@$skycells) {
@@ -793,5 +799,17 @@
                 # print "$tess_id $skycell_id $projection_cell\n";
 
-                my $command = "$stacktool -dbname $imagedb -summary -tess_id $tess_id";
+                my $command;
+                if ($release_name or $survey) {
+                    $command = "$releasetool -dbname $imagedb";
+                    if ($release_name) {
+                        $command .= " -release_name $release_name";
+                    } else {
+                        $command .= " -priority_order";
+                    }
+                    $command .= " -surveyName $survey";
+                } else {
+                    $command = "$stacktool -dbname $imagedb";
+                }
+                $command .= " -summary -tess_id $tess_id";
                 $command .= " -projection_cell $projection_cell";
 
@@ -836,4 +854,5 @@
     return $results;
 }
+
 sub lookup_diff {
     my $ipprc    = shift;
