Commit 48955951 authored by Gary Wong's avatar Gary Wong

Fix annoying SQL mistakes in ugly Powder resource queries.

parent f3010b7a
......@@ -1103,36 +1103,38 @@ function CalculateWirelessStatus(&$result) {
"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=''" );
"AND w.node_id2 LIKE 'ue%' AND (w.external_wire IS NULL " .
"OR w.external_wire='') AND r1.pid IS NULL AND r2.pid IS NULL" );
$row = mysql_fetch_array( $query_result );
$radiated1 = $row[ 'c' ];
$query_result =
DBQueryFatal( "SELECT COUNT(DISTINCT w.node_id2) FROM wires AS w " .
DBQueryFatal( "SELECT COUNT(DISTINCT w.node_id2) 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_id2 LIKE 'nuc%' " .
"AND w.node_id1 LIKE 'ue%' AND w.external_wire IS NULL " .
"OR w.external_wire=''" );
"AND w.node_id1 LIKE 'ue%' AND (w.external_wire IS NULL " .
"OR w.external_wire='') AND r1.pid IS NULL AND r2.pid IS NULL" );
$row = mysql_fetch_array( $query_result );
$radiated2 = $row[ 'c' ];
$query_result =
DBQueryFatal( "SELECT COUNT(DISTINCT w.node_id1) FROM wires AS w " .
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 != ''" );
"AND w.node_id2 LIKE 'ue%' AND w.external_wire != ''" .
"AND r1.pid IS NULL AND r2.pid IS NULL" );
$row = mysql_fetch_array( $query_result );
$controlled1 = $row[ 'c' ];
$query_result =
DBQueryFatal( "SELECT COUNT(DISTINCT w.node_id2) FROM wires AS w " .
DBQueryFatal( "SELECT COUNT(DISTINCT w.node_id2) 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_id2 LIKE 'nuc%' " .
"AND w.node_id1 LIKE 'ue%' AND w.external_wire != ''" );
"AND w.node_id1 LIKE 'ue%' AND w.external_wire != ''" .
"AND r1.pid IS NULL AND r2.pid IS NULL" );
$row = mysql_fetch_array( $query_result );
$controlled2 = $row[ 'c' ];
......
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