Index: /trunk/ippTools/share/disttool_definebyquery_camera.sql
===================================================================
--- /trunk/ippTools/share/disttool_definebyquery_camera.sql	(revision 23782)
+++ /trunk/ippTools/share/disttool_definebyquery_camera.sql	(revision 23783)
@@ -1,4 +1,4 @@
 SELECT
-    'cam' as stage,
+    'camera' as stage,
     camRun.cam_id as stage_id,
     rawExp.exp_name as run_tag,
@@ -16,3 +16,3 @@
     AND rcInterest.state = 'enabled'
     AND distRun.dist_id IS NULL      -- no existing distRun 
-    AND ((!distTarget.clean  AND camRun.state = 'full') OR (distTarget.clean AND camRun.state = 'cleaned'))
+    AND ((camRun.state = 'full') OR (distTarget.clean AND camRun.state = 'cleaned'))
Index: /trunk/ippTools/src/disttool.c
===================================================================
--- /trunk/ippTools/src/disttool.c	(revision 23782)
+++ /trunk/ippTools/src/disttool.c	(revision 23783)
@@ -157,8 +157,8 @@
 
     psString query = NULL;
-    psString runType = NULL;
+    psString magicRunType = NULL;
     psString runJoinStr = NULL;
     if (!strcmp(stage, "raw")) {
-        runType = "rawExp";
+        magicRunType = "rawExp";
         runJoinStr = "rawExp.exp_id";
         query = pxDataGet("disttool_definebyquery_raw.sql");
@@ -169,5 +169,5 @@
         }
     } else if (!strcmp(stage, "chip")) {
-        runType = "chipRun";
+        magicRunType = "chipRun";
         runJoinStr = "chipRun.chip_id";
         query = pxDataGet("disttool_definebyquery_chip.sql");
@@ -182,5 +182,5 @@
         }
     } else if (!strcmp(stage, "camera")) {
-        runType = "camRun";
+        magicRunType = "chipRun";    // This is used below to set the magicked business
         query = pxDataGet("disttool_definebyquery_camera.sql");
         if (!query) {
@@ -194,5 +194,5 @@
         }
     } else if (!strcmp(stage, "fake")) {
-        runType = "fakeRun";
+        magicRunType = "fakeRun";
         query = pxDataGet("disttool_definebyquery_fake.sql");
         if (!query) {
@@ -208,5 +208,5 @@
         no_magic = true;
     } else if (!strcmp(stage, "warp")) {
-        runType = "warpRun";
+        magicRunType = "warpRun";
         runJoinStr = "warpRun.warp_id";
         query = pxDataGet("disttool_definebyquery_warp.sql");
@@ -222,5 +222,5 @@
 
     } else if (!strcmp(stage, "diff")) {
-        runType = "diffRun";
+        magicRunType = "diffRun";
         runJoinStr = "diffRun.diff_id";
         query = pxDataGet("disttool_definebyquery_diff.sql");
@@ -236,5 +236,5 @@
 
     } else if (!strcmp(stage, "stack")) {
-        runType = "stackRun";
+        magicRunType = "stackRun";
         query = pxDataGet("disttool_definebyquery_stack.sql");
         if (!query) {
@@ -265,5 +265,5 @@
 
     if (!no_magic) {
-        psStringAppend(&query, " AND (distTarget.clean OR %s.magicked)", runType);
+        psStringAppend(&query, " AND (distTarget.clean OR %s.magicked)", magicRunType);
 
         // is selecting by magic_ds_id really interesting?
