Index: branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id.sql
===================================================================
--- branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id.sql	(revision 31587)
+++ branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id.sql	(revision 31628)
@@ -3,6 +3,6 @@
 FROM 
      staticskyResult
-join staticSkyRun using (sky_id)
-join staticSkyInput using (stack_id)
+join staticskyRun using (sky_id)
+join staticskyInput using(sky_id)
 JOIN stackRun USING(stack_id)
 
@@ -13,5 +13,5 @@
           ) as foo
      ON sky_id = added_sky_id 
-     AND stage = 'sky'
+     AND stage = 'staticsky'
      -- hook for qualifying the join on the previous_dvodb
      AND %s
Index: branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id_dvo.sql
===================================================================
--- branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id_dvo.sql	(revision 31587)
+++ branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id_dvo.sql	(revision 31628)
@@ -1,4 +1,7 @@
 SELECT staticskyRun.* FROM staticskyResult
 JOIN staticskyRun USING(sky_id)
+join staticskyInput using(sky_id)
+JOIN stackRun USING(stack_id)
+
 WHERE staticskyRun.state = 'full' and staticskyResult.quality = 0
     AND sky_id NOT IN (SELECT sky_id
Index: branches/eam_branches/ipp-20110505/ippTools/share/laptool_definerun.sql
===================================================================
--- branches/eam_branches/ipp-20110505/ippTools/share/laptool_definerun.sql	(revision 31587)
+++ branches/eam_branches/ipp-20110505/ippTools/share/laptool_definerun.sql	(revision 31628)
@@ -8,9 +8,17 @@
   ) AS want
   LEFT JOIN 
-  (SELECT exp_id,MAX(chip_id) AS chip_id
-     FROM lapExp 
+  (SELECT exp_id,MAX(chip_id) AS chip_id, chipRun.state
+     FROM lapExp JOIN chipRun USING(exp_id,chip_id) 
      where private IS FALSE 
      AND chip_id IS NOT NULL
-     AND active = TRUE ) AS have USING(exp_id)
+     AND 
+     	 (
+	  -- (active = TRUE) OR 
+	  (chipRun.state = 'full') OR
+	  (chipRun.state = 'new')
+	  -- when we can do updates, put that here.
+	  )
+     GROUP BY exp_id
+) AS have USING(exp_id)
      
 
Index: branches/eam_branches/ipp-20110505/ippTools/share/regtool_pendingimfile.sql
===================================================================
--- branches/eam_branches/ipp-20110505/ippTools/share/regtool_pendingimfile.sql	(revision 31587)
+++ branches/eam_branches/ipp-20110505/ippTools/share/regtool_pendingimfile.sql	(revision 31628)
@@ -8,8 +8,10 @@
     newImfile.uri,
     newImfile.bytes,
-    newImfile.md5sum
+    newImfile.md5sum,
+    summitExp.dateobs AS summit_dateobs
 FROM newImfile
 JOIN newExp
     USING(exp_id)
+JOIN summitExp USING(summit_id)
 LEFT JOIN rawImfile
     ON newExp.exp_id = rawImfile.exp_id
