Index: trunk/ippTools/share/magicdstool_todestreak_diff.sql
===================================================================
--- trunk/ippTools/share/magicdstool_todestreak_diff.sql	(revision 27945)
+++ trunk/ippTools/share/magicdstool_todestreak_diff.sql	(revision 29358)
@@ -20,5 +20,6 @@
     recoveryroot,
     re_place,
-    remove
+    remove,
+    IFNULL(Label.priority, 10000) AS priority
 FROM rawExp
 JOIN magicRun USING (exp_id)
@@ -33,4 +34,5 @@
     ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id
     AND magicDSFile.component = diffSkyfile.skycell_id
+LEFT JOIN Label ON magicDSRun.label = Label.label
 WHERE
     magicDSRun.state = 'new'
@@ -40,4 +42,5 @@
     AND diffSkyfile.quality = 0
     AND magicDSFile.component IS NULL
+    AND (Label.active OR Label.active IS NULL)
 -- bothways diffSkyfiles
 UNION
@@ -62,5 +65,6 @@
     recoveryroot,
     re_place,
-    remove
+    remove,
+    IFNULL(Label.priority, 10000) AS priority
 FROM rawExp
 JOIN magicRun USING (exp_id)
@@ -75,4 +79,5 @@
     ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id
     AND magicDSFile.component = diffSkyfile.skycell_id
+LEFT JOIN Label ON magicDSRun.label = Label.label
 WHERE
     magicDSRun.state = 'new'
@@ -82,4 +87,5 @@
     AND diffSkyfile.quality = 0
     AND magicDSFile.component IS NULL
+    AND (Label.active OR Label.active IS NULL)
 ) AS magicDSRun
 -- we need the following so this query is compatible with the other stages
