Changeset 7527 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
02/24/06 19:12:49 (19 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7526 r7527  
    2424       (P31 - P39, without P36!(problems with spline))
    2525
     26
     27
    2628 2006/02/24 Daniela Dorner
     29
     30   * datacenter/db/datacheck.php, datasetinfo.php, dbstatus.php,
     31     findoffdata.php, include.php, magicdefs.php, runinfo.php,
     32     sequinfo.php, statusrps.php, statussbs.php, statussps.php:
     33     - included failure handling columns
    2734
    2835   * datacenter/db/findoffdata.php:
    2936     - added DT
     37
     38   * datacenter/db/statusrps.php:
     39     - fixed bug
    3040
    3141   * datacenter/db/sequinfo.php:
  • trunk/MagicSoft/Mars/datacenter/db/datacheck.php

    r7484 r7527  
    11<?php
    22{
    3     function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup)
     3    function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup, $needs)
    44    {
    55        $fromtable="RunData";
     
    3535                foreach ($checkstatusgroup as $key => $element)
    3636                    if ($element==-1)
    37                         $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
     37                        $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] . "', ";
     38//                        $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
    3839
    3940                $query0 .= " count(*) as 'Runs'";
     
    100101            $query0 .= " AND ";
    101102
    102         $query0 .= StatusQuery("fRawFileAvail");
    103         $query0 .= StatusQuery("fDataCheckDone");
     103        $query0 .= StatusQuery("fRawFileAvail", $needs);
     104        $query0 .= StatusQuery("fDataCheckDone", $needs);
    104105
    105106        $query0 .= EnumQuery("fHasSignal");
     
    379380    }
    380381
    381     function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup)
     382    function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup, $needs)
    382383    {
    383384        $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
     
    389390        mysql_select_db($db);
    390391
    391         $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup);
     392        $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup, $needs);
    392393
    393394        $result0 = mysql_query($query0, $db_id);
     
    420421        header("Content-Disposition: attachment; filename=query-result.txt");
    421422
    422         PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup);
     423        PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup, $needs);
    423424    }
    424425    else
     
    437438        {
    438439            if (empty($_GET["fPrintTable"]))
    439                 PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup);
     440                PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup, $needs);
    440441            else
    441                 PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup);
     442                PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup, $needs);
    442443        }
    443444
  • trunk/MagicSoft/Mars/datacenter/db/datasetinfo.php

    r7484 r7527  
    11<?php
    22{
    3     function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup)
     3    function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs)
    44    {
    55        $fromtable="DataSets";
     
    3030                foreach ($checkstatusgroup as $key => $element)
    3131                    if ($element==-1)
    32                         $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
     32                        $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] . "', ";
     33//                        $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
    3334
    3435                $query0 .= " count(*) as 'DataSet#'";
     
    8384            $query0 .= " AND ";
    8485
    85         $query0 .= StatusQuery("fDataSetInserted");
    86         $query0 .= StatusQuery("fStarFilesAvail");
    87         $query0 .= StatusQuery("fGanymed");
    88         $query0 .= StatusQuery("fFillGanymed");
     86        $query0 .= StatusQuery("fDataSetInserted", $needs);
     87        $query0 .= StatusQuery("fStarFilesAvail", $needs);
     88        $query0 .= StatusQuery("fGanymed", $needs);
     89        $query0 .= StatusQuery("fFillGanymed", $needs);
    8990
    9091        if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
     
    332333    }
    333334
    334     function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup)
     335    function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs)
    335336    {
    336337        $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
     
    342343        mysql_select_db($db);
    343344
    344         $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup);
     345        $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    345346
    346347        $result0 = mysql_query($query0, $db_id);
     
    390391        {
    391392            if (empty($_GET["fPrintTable"]))
    392                 PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
     393                PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    393394            else
    394                 PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
     395                PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    395396        }
    396397
  • trunk/MagicSoft/Mars/datacenter/db/dbstatus.php

    r7484 r7527  
    11<?php
    22{
    3     function CreateQuery($_GET, $alias)
     3    function CreateQuery($_GET, $alias, $needs)
    44    {
    55        $joins = array
     
    7272                foreach ($checkstatusgroup as $key => $element)
    7373                    if ($element==-1)
    74                         $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
     74                        $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] . "', ";
     75//                        $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
    7576
    7677                $query0 .= " count(*) as 'Sequence#'";
     
    125126            $query0 .= " AND ";
    126127
    127         $query0 .= StatusQuery("fSequenceFileWritten");
    128         $query0 .= StatusQuery("fAllFilesAvail");
    129         $query0 .= StatusQuery("fCallisto");
    130         $query0 .= StatusQuery("fFillCallisto");
    131         $query0 .= StatusQuery("fStar");
    132         $query0 .= StatusQuery("fFillStar");
     128        $query0 .= StatusQuery("fSequenceFileWritten", $needs);
     129        $query0 .= StatusQuery("fAllFilesAvail", $needs);
     130        $query0 .= StatusQuery("fCallisto", $needs);
     131        $query0 .= StatusQuery("fFillCallisto", $needs);
     132        $query0 .= StatusQuery("fStar", $needs);
     133        $query0 .= StatusQuery("fFillStar", $needs);
    133134
    134135        if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
     
    330331    }
    331332
    332     function PrintPage($html, $db)
     333    function PrintPage($html, $db, $needs)
    333334    {
    334335        $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
     
    353354            );
    354355
    355         $query0 = CreateQuery($_GET, $alias);
     356        $query0 = CreateQuery($_GET, $alias, $needs);
    356357
    357358        $result0 = mysql_query($query0, $db_id);
     
    400401        {
    401402            if (empty($_GET["fPrintTable"]))
    402                 PrintPage("1", $db);
     403                PrintPage("1", $db, $needs);
    403404            else
    404                 PrintPage("2", $db);
     405                PrintPage("2", $db, $needs);
    405406        }
    406407
  • trunk/MagicSoft/Mars/datacenter/db/findoffdata.php

    r7523 r7527  
    11<?php
    22{
    3     function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup)
     3    function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs)
    44    {
    55        $fromtable="Sequences";
     
    3636                foreach ($checkstatusgroup as $key => $element)
    3737                    if ($element==-1)
    38                         $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
     38                        $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] . "', ";
     39//                        $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
    3940
    4041                $query0 .= " count(*) as 'Sequence'";
     
    119120            $query0 .= " AND ";
    120121
    121         $query0 .= StatusQuery("fStar");
     122        $query0 .= StatusQuery("fStar", $needs);
    122123
    123124        if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
     
    603604    }
    604605
    605     function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms)
     606    function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms, $needs)
    606607    {
    607608        $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
     
    613614        mysql_select_db($db);
    614615
    615         $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup);
     616        $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    616617
    617618        $result0 = mysql_query($query0, $db_id);
     
    644645        header("Content-Disposition: attachment; filename=query-result.txt");
    645646
    646         PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms);
     647        PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms, $needs);
    647648    }
    648649    else
     
    661662        {
    662663            if (empty($_GET["fPrintTable"]))
    663                 PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms);
    664             else
    665                 PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms);
     664                PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms, $needs);
     665            else
     666                PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limits, $rms, $needs);
    666667        }
    667668
  • trunk/MagicSoft/Mars/datacenter/db/include.php

    r7484 r7527  
    104104}
    105105
    106 function StatusQuery($name)
     106function StatusQuery($name, $needs)
    107107{
    108108    $var  = $name . "Status";
     
    112112    case 0: $txt .= ""; break;
    113113    case 1: $txt .= "NOT (IsNull(" . $name . ") OR " . $name . "='1970-01-01 00:00:00') AND "; break;
    114     case 2: $txt .= "IsNull(" . $name . ") AND "; break;
     114    case 2: $txt .= "IsNull(" . $name . ") AND IsNull(fStartTime) AND IsNull(fFailedTime) AND NOT IsNull(" . $needs[$name] . ") AND "; break;
    115115    case 3: $txt .= $name ."='1970-01-01 00:00:00' AND "; break;
    116     case 4: $txt .= ""; break;
     116    case 4: $txt .= " (IsNull(" . $name . ") AND IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND date_sub(Now(),interval 12 hour) < fStartTime AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
     117    case 5: $txt .= " (IsNull(" . $name . ") AND NOT IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
     118    case 6: $txt .= " (IsNull(" . $name . ") AND IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND date_sub(Now(),interval 12 hour) > fStartTime AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
     119//    case 6: $txt .= "crashed"; break;
     120    case 7: $txt .= ""; break;
    117121    }
    118122    return $txt;
     
    138142          2 => "not done",
    139143          3 => "not to be done",
    140           4 => "group by"
     144          4 => "running",
     145          5 => "failed",
     146          6 => "crashed",
     147          7 => "group by",
    141148        );
    142149
    143150    $stat=$_GET[$var];
    144     for ($i=0; $i<5; $i++)
     151    for ($i=0; $i<8; $i++)
    145152    {
    146153        if ($stat==$i)
     
    399406    foreach ($_GET as $key => $element)
    400407        if ($key==$column)
    401             if ($element==4)
     408            if ($element==7)
    402409                return -1;
    403410    return 0;
  • trunk/MagicSoft/Mars/datacenter/db/magicdefs.php

    r7521 r7527  
    11<?php
     2
     3$needs = array
     4    (
     5     "fCCFilled"             => "SequenceBuildStatus.fDate",
     6     "fExclusionsDone"       => "fCCFilled",
     7     "fSequenceEntriesBuilt" => "fExclusionsDone",
     8     "fCCFileAvail"          => "RunProcessStatus.fRunNumber",
     9     "fCaCoFileAvail"        => "RunProcessStatus.fRunNumber",
     10     "fCaCoFileFound"        => "RunProcessStatus.fRunNumber",
     11     "fRawFileAvail"         => "RunProcessStatus.fRunNumber",
     12     "fDataCheckDone"        => "fRawFileAvail",
     13     "fTimingCorrection"     => "fRawFileAvail",
     14     "fSequenceFileWritten"  => "SequenceProcessStatus.fSequenceFirst",
     15     "fAllFilesAvail"        => "fSequenceFileWritten",
     16     "fCallisto"             => "fAllFilesAvail",
     17     "fStar"                 => "fCallisto",
     18     "fFillCallisto"         => "fCallisto",
     19     "fFillStar"             => "fStar",
     20     "fDataSetInserted"      => "DataSetProcessStatus.fDataSetNumber",
     21     "fStarFilesAvail"       => "fDataSetInserted",
     22     "fGanymed"              => "fStarFilesAvail",
     23     "fFillGanymed"          => "fGanymed",
     24     );
     25
    226
    327$limits = array
     
    7094     "fCaCoFileAvail"                    => CheckStatusGroup("fCaCoFileAvailStatus",       $_GET),
    7195     "fCaCoFileFound"                    => CheckStatusGroup("fCaCoFileFoundStatus",       $_GET),
    72      "fRawFileAvail"                     => CheckStatusGroup("fRawFileAvailStatu",         $_GET),
     96     "fRawFileAvail"                     => CheckStatusGroup("fRawFileAvailStatus",        $_GET),
    7397     "fTimingCorrection"                 => CheckStatusGroup("fTimingCorrectionStatus",    $_GET),
    7498     "fDataCheckDone"                    => CheckStatusGroup("fDataCheckDoneStatus",       $_GET),
     
    145169     "fCaCoFileAvail"                   => "CaCoFile",
    146170     "fCaCoFileFound"                   => "CaCoRun",
    147      "fRawFileAvail"                    => "Rawfile",
     171     "fRawFileAvail"                    => "RawFile",
    148172     "fTimingCorrection"                => "TimingCorr",
    149173     "fDataCheckDone"                   => "Datacheck",
     
    236260     "fEMin"                            => "Emin",
    237261     "fEMax"                            => "Emax",
     262     "fStartTime"                       => "Process",
     263     "fFailedTime"                      => "Failed",
     264     "fReturnCode"                      => "Ret<br>Code",
     265     "fFailedCode"                      => "Err<br>Code",
     266     "fFailedCodeAdd"                   => "Code<br>Add",
    238267    );
    239268
     
    309338     $alias["fPositionAsymInterlaced"]   => "1",
    310339     $alias["fHeightAsymInterlaced"]     => "1",
     340     $alias["fReturnCode"]               => "1",
     341     $alias["fFailedCode"]               => "1",
     342     $alias["fFailedCodeAdd"]            => "1",
    311343     "Time"                              => "1",
    312344//     "Time [h]"                 => "1",
     
    468500         "Max(fZenithDistance)"              => "'ZdMax'",
    469501//         "COUNT(*)"                          => "'Sequ'",
     502         "fStartTime"                       => "fStartTime",
     503         "fFailedTime"                      => "fFailedTime",
     504         "fReturnCode"                      => "fReturnCode",
     505         "fFailedCode"                      => "fFailedCode",
     506         "fFailedCodeAdd"                   => "fFailedCodeAdd",
    470507        );
    471508
  • trunk/MagicSoft/Mars/datacenter/db/runinfo.php

    r7484 r7527  
    11<?php
    22{
    3     function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup)
     3    function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs)
    44    {
    55        $fromtable="RunData";
     
    4040                foreach ($checkstatusgroup as $key => $element)
    4141                    if ($element==-1)
    42                         $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
     42                        $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] . "', ";
     43//                        $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
    4344
    4445                $query0 .= " count(*) as 'Run#'";
     
    9293            $query0 .= " AND ";
    9394
    94         $query0 .= StatusQuery("fCCFileAvail");
    95         $query0 .= StatusQuery("fCaCoFileAvail");
    96         $query0 .= StatusQuery("fCaCoFileFound");
    97         $query0 .= StatusQuery("fRawFileAvail");
    98         $query0 .= StatusQuery("fDataCheckDone");
    99         $query0 .= StatusQuery("fTimingCorrection");
     95        $query0 .= StatusQuery("fCCFileAvail", $needs);
     96        $query0 .= StatusQuery("fCaCoFileAvail", $needs);
     97        $query0 .= StatusQuery("fCaCoFileFound", $needs);
     98        $query0 .= StatusQuery("fRawFileAvail", $needs);
     99        $query0 .= StatusQuery("fDataCheckDone", $needs);
     100        $query0 .= StatusQuery("fTimingCorrection", $needs);
    100101
    101102        if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
     
    476477    }
    477478
    478     function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup)
     479    function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs)
    479480    {
    480481        $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
     
    487488        mysql_query("SET BIG_TABLES=1"); // necessary for mySQL <= 4
    488489
    489         $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup);
     490        $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    490491
    491492        $result0 = mysql_query($query0, $db_id);
     
    518519        header("Content-Disposition: attachment; filename=query-result.txt");
    519520
    520         PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
     521        PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    521522    }
    522523    else
     
    535536        {
    536537            if (empty($_GET["fPrintTable"]))
    537                 PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
     538                PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    538539            else
    539                 PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
     540                PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    540541        }
    541542
  • trunk/MagicSoft/Mars/datacenter/db/sequinfo.php

    r7524 r7527  
    11<?php
    22{
    3     function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup)
     3    function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs)
    44    {
    55        $fromtable="Sequences";
     
    3636                foreach ($checkstatusgroup as $key => $element)
    3737                    if ($element==-1)
    38                         $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
     38                        $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] . "', ";
     39//                        $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
    3940
    4041                $query0 .= " count(*) as 'Sequence'";
     
    110111            $query0 .= " AND ";
    111112
    112         $query0 .= StatusQuery("fSequenceFileWritten");
    113         $query0 .= StatusQuery("fAllFilesAvail");
    114         $query0 .= StatusQuery("fCallisto");
    115         $query0 .= StatusQuery("fFillCallisto");
    116         $query0 .= StatusQuery("fStar");
    117         $query0 .= StatusQuery("fFillStar");
     113        $query0 .= StatusQuery("fSequenceFileWritten", $needs);
     114        $query0 .= StatusQuery("fAllFilesAvail", $needs);
     115        $query0 .= StatusQuery("fCallisto", $needs);
     116        $query0 .= StatusQuery("fFillCallisto", $needs);
     117        $query0 .= StatusQuery("fStar", $needs);
     118        $query0 .= StatusQuery("fFillStar", $needs);
    118119
    119120        if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
     
    385386            $_GET["fMaxHumidity"]="Off";
    386387
     388        if (empty($_GET["fStartTime"]))
     389            $_GET["fStartTime"]="Off";
     390
     391        if (empty($_GET["fFailedTime"]))
     392            $_GET["fFailedTime"]="Off";
     393
     394        if (empty($_GET["fReturnCode"]))
     395            $_GET["fReturnCode"]="Off";
     396
     397        if (empty($_GET["fFailedCode"]))
     398            $_GET["fFailedCode"]="Off";
     399
     400        if (empty($_GET["fFailedCodeAdd"]))
     401            $_GET["fFailedCodeAdd"]="Off";
     402
    387403    }
    388404
     
    426442        printf("</td></tr> </table>\n");
    427443        printf(" <p>\n");
     444
     445        printf(" <table>\n");
     446        printf("  <tr>\n");
     447
     448        CheckBox("fStartTime",     "StartTime");
     449        CheckBox("fFailedTime",    "FailedTime");
     450        CheckBox("fReturnCode",    "ErrCode");
     451        CheckBox("fFailedCode",    "RetCode");
     452        CheckBox("fFailedCodeAdd", "CodeAdd");
     453
     454        printf("  </tr>\n");
     455        printf(" </table>\n");
     456        printf(" <p>\n");
     457
    428458        printf(" <table>\n");
    429459        printf("  <tr>\n");
     
    584614    }
    585615
    586     function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup)
     616    function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs)
    587617    {
    588618        $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
     
    594624        mysql_select_db($db);
    595625
    596         $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup);
     626        $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    597627
    598628        $result0 = mysql_query($query0, $db_id);
     
    625655        header("Content-Disposition: attachment; filename=query-result.txt");
    626656
    627         PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
     657        PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    628658    }
    629659    else
     
    642672        {
    643673            if (empty($_GET["fPrintTable"]))
    644                 PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
     674                PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    645675            else
    646                 PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup);
     676                PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
    647677        }
    648678
  • 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"));
  • trunk/MagicSoft/Mars/datacenter/db/statussbs.php

    r7484 r7527  
    11<?php
    22{
    3     function CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere)
     3    function CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere, $needs)
    44    {
    55        $statusgroups = 0;
     
    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 '" . $alias[$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 '" . $alias[$key] . "', ";
    1718
    1819            $query0 .= " count(*) as '#days'";
     
    4344            $query0 .= " AND ";
    4445
    45         $query0 .= StatusQuery("fCCFilled");
    46         $query0 .= StatusQuery("fExclusionsDone");
    47         $query0 .= StatusQuery("fSequenceEntriesBuilt");
     46        $query0 .= StatusQuery("fCCFilled", $needs);
     47        $query0 .= StatusQuery("fExclusionsDone", $needs);
     48        $query0 .= StatusQuery("fSequenceEntriesBuilt", $needs);
    4849
    4950        $query0 .= "fDate BETWEEN '" . $_GET["fRunMin"] . "' AND '" . $_GET["fRunMax"] . "' ";
     
    165166    }
    166167
    167     function PrintPage($html, $db, $alias, $rightalign, $checkstatusgroup, $checkwhere)
     168    function PrintPage($html, $db, $alias, $rightalign, $checkstatusgroup, $checkwhere, $needs)
    168169    {
    169170        $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
     
    175176        mysql_select_db($db);
    176177
    177         $query0 = CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere);
     178        $query0 = CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere, $needs);
    178179
    179180        $result0 = mysql_query($query0, $db_id);
     
    206207        header("Content-Disposition: attachment; filename=query-result.txt");
    207208
    208         PrintPage("0", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere);
     209        PrintPage("0", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere, $needs);
    209210    }
    210211    else
     
    220221            printf("No query submitted yet.<BR>");
    221222        else
    222             PrintPage("1", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere);
     223            PrintPage("1", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere, $needs);
    223224
    224225        echo (file_get_contents("index-footer.html"));
  • trunk/MagicSoft/Mars/datacenter/db/statussps.php

    r7484 r7527  
    11<?php
    22{
    3     function CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere)
     3    function CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere, $needs)
    44    {
    55        $statusgroups = 0;
     
    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 '" . $alias[$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 '" . $alias[$key] . "', ";
    1718
    1819            $query0 .= " count(*) as 'Sequence#'";
     
    4041            $query0 .= " AND ";
    4142
    42         $query0 .= StatusQuery("fSequenceFileWritten");
    43         $query0 .= StatusQuery("fAllFilesAvail");
    44         $query0 .= StatusQuery("fCallisto");
    45         $query0 .= StatusQuery("fFillCallisto");
    46         $query0 .= StatusQuery("fStar");
    47         $query0 .= StatusQuery("fFillStar");
     43        $query0 .= StatusQuery("fSequenceFileWritten", $needs);
     44        $query0 .= StatusQuery("fAllFilesAvail", $needs);
     45        $query0 .= StatusQuery("fCallisto", $needs);
     46        $query0 .= StatusQuery("fFillCallisto", $needs);
     47        $query0 .= StatusQuery("fStar", $needs);
     48        $query0 .= StatusQuery("fFillStar", $needs);
    4849
    4950        $query0 .= "fSequenceFirst BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " ";
     
    178179    }
    179180
    180     function PrintPage($html, $db, $alias, $rightalign, $checkstatusgroup, $checkwhere)
     181    function PrintPage($html, $db, $alias, $rightalign, $checkstatusgroup, $checkwhere, $needs)
    181182    {
    182183        $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
     
    188189        mysql_select_db($db);
    189190
    190         $query0 = CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere);
     191        $query0 = CreateQuery($_GET, $alias, $checkstatusgroup, $checkwhere, $needs);
    191192
    192193        $result0 = mysql_query($query0, $db_id);
     
    219220        header("Content-Disposition: attachment; filename=query-result.txt");
    220221
    221         PrintPage("0", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere);
     222        PrintPage("0", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere, $needs);
    222223    }
    223224    else
     
    233234            printf("No query submitted yet.<BR>");
    234235        else
    235             PrintPage("1", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere);
     236            PrintPage("1", $db, $alias, $rightalign, $checkstatusgroup, $checkwhere, $needs);
    236237
    237238        echo (file_get_contents("index-footer.html"));
Note: See TracChangeset for help on using the changeset viewer.