Index: trunk/MagicSoft/Mars/datacenter/db/dbstatus.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/dbstatus.php	(revision 7484)
+++ trunk/MagicSoft/Mars/datacenter/db/dbstatus.php	(revision 7527)
@@ -1,5 +1,5 @@
 <?php
 {
-    function CreateQuery($_GET, $alias)
+    function CreateQuery($_GET, $alias, $needs)
     {
         $joins = array
@@ -72,5 +72,6 @@
                 foreach ($checkstatusgroup as $key => $element)
                     if ($element==-1)
-                        $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
+                        $query0 .= " (if(IsNull(" . $key . "), if(isnull(fStartTime), 'not done', if(isnull(fFailedTime),if(isnull(" . $needs[$key] . "),'not done',if(date_sub(Now(),interval 12 hour) < fStartTime,'running','crashed')),if(isnull(" . $needs[$key] . "),'not done','failed'))) ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
+//                        $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
 
                 $query0 .= " count(*) as 'Sequence#'";
@@ -125,10 +126,10 @@
             $query0 .= " AND ";
 
-        $query0 .= StatusQuery("fSequenceFileWritten");
-        $query0 .= StatusQuery("fAllFilesAvail");
-        $query0 .= StatusQuery("fCallisto");
-        $query0 .= StatusQuery("fFillCallisto");
-        $query0 .= StatusQuery("fStar");
-        $query0 .= StatusQuery("fFillStar");
+        $query0 .= StatusQuery("fSequenceFileWritten", $needs);
+        $query0 .= StatusQuery("fAllFilesAvail", $needs);
+        $query0 .= StatusQuery("fCallisto", $needs);
+        $query0 .= StatusQuery("fFillCallisto", $needs);
+        $query0 .= StatusQuery("fStar", $needs);
+        $query0 .= StatusQuery("fFillStar", $needs);
 
         if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
@@ -330,5 +331,5 @@
     }
 
-    function PrintPage($html, $db)
+    function PrintPage($html, $db, $needs)
     {
         $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
@@ -353,5 +354,5 @@
             );
 
-        $query0 = CreateQuery($_GET, $alias);
+        $query0 = CreateQuery($_GET, $alias, $needs);
 
         $result0 = mysql_query($query0, $db_id);
@@ -400,7 +401,7 @@
         {
             if (empty($_GET["fPrintTable"]))
-                PrintPage("1", $db);
+                PrintPage("1", $db, $needs);
             else
-                PrintPage("2", $db);
+                PrintPage("2", $db, $needs);
         }
 
