Commit 5511a8ec authored by Gary Wong's avatar Gary Wong

Add CalculateWirelessStatus() function.

Intended to estimate Powder wireless resources to appear on the front page.
This is HORRIBLY quick and dirty and definitely needs to be thrown away.
It estimates the number of OAI experiments (1 SDR + 1 OTS UE) that could
be accommodated as a stopgap measure for the tech preview demo.  It must
be replaced before we have real wireless sites installed.
parent a670b802
......@@ -1097,6 +1097,53 @@ function CalculateAggregateStatus(&$amlist, &$fedlist, &$status,
}
}
function CalculateWirelessStatus() {
$result = array();
$query_result =
DBQueryFatal( "SELECT COUNT(DISTINCT w.node_id1) AS c FROM wires AS w " .
"LEFT OUTER JOIN reserved AS r1 ON " .
"w.node_id1=r1.node_id LEFT OUTER JOIN reserved AS r2 " .
"ON w.node_id2=r2.node_id WHERE w.node_id1 LIKE 'nuc%' " .
"AND w.node_id2 LIKE 'ue%' AND w.external_wire IS NULL" .
"OR w.external_wire=''" );
$row = mysql_fetch_array( $query_result );
$radiated1 = $row[ 'c' ];
$query_result =
DBQueryFatal( "SELECT COUNT(DISTINCT w.node_id2) FROM wires AS w " .
"LEFT OUTER JOIN reserved AS r1 ON " .
"w.node_id1=r1.node_id LEFT OUTER JOIN reserved AS r2 " .
"ON w.node_id2=r2.node_id WHERE w.node_id2 LIKE 'nuc%' " .
"AND w.node_id1 LIKE 'ue%' AND w.external_wire IS NULL" .
"OR w.external_wire=''" );
$row = mysql_fetch_array( $query_result );
$radiated2 = $row[ 'c' ];
$query_result =
DBQueryFatal( "SELECT COUNT(DISTINCT w.node_id1) FROM wires AS w " .
"LEFT OUTER JOIN reserved AS r1 ON " .
"w.node_id1=r1.node_id LEFT OUTER JOIN reserved AS r2 " .
"ON w.node_id2=r2.node_id WHERE w.node_id1 LIKE 'nuc%' " .
"AND w.node_id2 LIKE 'ue%' AND w.external_wire != ''" );
$row = mysql_fetch_array( $query_result );
$controlled1 = $row[ 'c' ];
$query_result =
DBQueryFatal( "SELECT COUNT(DISTINCT w.node_id2) FROM wires AS w " .
"LEFT OUTER JOIN reserved AS r1 ON " .
"w.node_id1=r1.node_id LEFT OUTER JOIN reserved AS r2 " .
"ON w.node_id2=r2.node_id WHERE w.node_id2 LIKE 'nuc%' " .
"AND w.node_id1 LIKE 'ue%' AND w.external_wire != ''" );
$row = mysql_fetch_array( $query_result );
$controlled2 = $row[ 'c' ];
return array(
"radiated" => $radiated1 + $radiated2;
"controlled" => $controlled1 + $controlled2;
);
}
function SpitAggregateStatus($extended = false) {
$amlist = array();
$fedlist = array();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment