Ignore:
Timestamp:
02/24/06 19:12:49 (19 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/db/statusrps.php

    r7484 r7527  
    11<?php
    22{
    3     function CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere)
     3    function CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere, $needs)
    44    {
    55        $query0 = "SELECT ";
     
    1414            foreach ($checkstatusgroup as $key => $element)
    1515                if ($element==-1)
    16                     $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $key . "', ";
     16                    $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] . "', ";
     17//                    $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $key . "', ";
    1718
    1819            $query0 .= " count(*) as 'Run#'";
     
    3637            $query0 .= " AND ";
    3738
    38         $query0 .= StatusQuery("fCCFileAvail");
    39         $query0 .= StatusQuery("fCaCoFileAvail");
    40         $query0 .= StatusQuery("fCaCoFileFound");
    41         $query0 .= StatusQuery("fRawFileAvail");
    42         $query0 .= StatusQuery("fDataCheckDone");
    43         $query0 .= StatusQuery("fTimingCorrection");
     39        $query0 .= StatusQuery("fCCFileAvail", $needs);
     40        $query0 .= StatusQuery("fCaCoFileAvail", $needs);
     41        $query0 .= StatusQuery("fCaCoFileFound", $needs);
     42        $query0 .= StatusQuery("fRawFileAvail", $needs);
     43        $query0 .= StatusQuery("fDataCheckDone", $needs);
     44        $query0 .= StatusQuery("fTimingCorrection", $needs);
    4445
    4546        $query0 .= "fRunNumber BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " ";
     
    5253                if ($element==-1)
    5354                {
    54                     $query0 .= $key;
     55                    $query0 .= $alias[$key];
    5556                    if ($num-->1)
    5657                        $query0 .= ", ";
     
    189190    }
    190191
    191     function PrintPage($html, $db, $alias, $rightalign, $checkstatusgroup, $checkwhere)
     192    function PrintPage($html, $db, $alias, $rightalign, $checkstatusgroup, $checkwhere, $needs)
    192193    {
    193194        $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
     
    199200        mysql_select_db($db);
    200201
    201         $query0 = CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere);
     202        $query0 = CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere, $needs);
    202203
    203204        $result0 = mysql_query($query0, $db_id);
     
    230231        header("Content-Disposition: attachment; filename=query-result.txt");
    231232
    232         PrintPage("0", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere);
     233        PrintPage("0", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere, $needs);
    233234    }
    234235    else
     
    244245            printf("No query submitted yet.<BR>");
    245246        else
    246             PrintPage("1", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere);
     247            PrintPage("1", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere, $needs);
    247248
    248249        echo (file_get_contents("index-footer.html"));
Note: See TracChangeset for help on using the changeset viewer.