Ticket #39: overview.php.patch

File overview.php.patch, 938 bytes (added by aloga@…, 14 years ago)
  • web/addons/job_monarch/overview.php

    old new  
    220220       $empty_cpus += $node_freecpu;
    221221   }
    222222
    223    $used_cpus      = $nr_cpus - $empty_cpus;
     223    $empty_cpus = $empty_cpus ? $empy_cpus >=0 : 0;
     224
     225    $used_cpus     = $nr_cpus - $empty_cpus;
    224226
    225227   $empty_percentage   = ($empty_cpus / $nr_cpus) * 100;
    226228
     
    695697   $tpl->assignGlobal("used_jobs", $used_jobs );
    696698   $tpl->assignGlobal("used_cpus", $used_cpus );
    697699
    698    $free_nodes = $avail_nodes - $running_nodes;
    699    $free_cpus = $avail_cpus - $running_cpus;
     700   $free_nodes = ($avail_nodes - $running_nodes) >= 0 ? $avail_nodes - $running_nodes : 0;
     701   $free_cpus = ($avail_cpus - $running_cpus) >= 0 ? $avail_cpus - $running_cpus : 0;
    700702
    701703   $tpl->assignGlobal("free_nodes", $free_nodes );
    702704   $tpl->assignGlobal("free_cpus", $free_cpus );