IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27861


Ignore:
Timestamp:
May 5, 2010, 11:59:12 AM (16 years ago)
Author:
rhenders
Message:

Simplified counts on diff stage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czartool.pl

    r27775 r27861  
    118118
    119119    my $item;
    120     foreach $item (@array1, @array2) { $count{$item}++;}
     120    foreach $item (@array1, @array2) {$count{$item}++;}
    121121
    122122    foreach $item (keys %count) {
     
    350350    elsif ($stage eq "magic") {$joinTable="magicNodeResult";}
    351351    elsif ($stage eq "magicDS") {$id = "magic_ds_id"; $joinTable="magicDSFile";}
    352     elsif ($stage eq "dist") {return countDistFaults($label);}
     352    elsif ($stage eq "dist") {$joinTable="distComponent";}
    353353    else {return -1;}
    354354
    355355    my $faultCol =  $joinTable.".fault";
     356    my $stateCol =  $table.".state";
    356357
    357358    my $query = $db->prepare(<<SQL);
     
    361362        WHERE label LIKE '$label'
    362363        AND $faultCol != 0
    363         AND state = 'new'
     364        AND $stateCol = 'new'
    364365
    365366SQL
     
    369370}
    370371
    371 ###########################################################################
    372 #
    373 # Counts total distribution faults
    374 #
    375 ###########################################################################
    376 sub countDistFaults {
    377     my ($label) = @_;
    378 
    379     my $query = $db->prepare(<<SQL);
    380     SELECT COUNT(*)
    381         FROM distRun
    382         JOIN distComponent USING(dist_id)
    383         WHERE label LIKE '$label'
    384         AND distComponent.fault > 0
    385         AND distRun.state = 'new'
    386 
    387 SQL
    388 
    389         $query->execute;
    390     my $count = $query->fetchrow_array();
    391 
    392     $query = $db->prepare(<<SQL);
    393     SELECT COUNT(*)
    394         FROM distRun
    395         WHERE label LIKE '$label'
    396         AND fault > 0
    397         AND distRun.state = 'new'
    398 
    399 SQL
    400 
    401         $query->execute;
    402 
    403     return $count + $query->fetchrow_array();
    404 }
    405 
Note: See TracChangeset for help on using the changeset viewer.