This commit is contained in:
2025-12-09 07:52:03 +00:00
parent 185edd3d14
commit 4cb249b73a
2 changed files with 15 additions and 41 deletions

View File

@@ -1866,17 +1866,26 @@ elseif ($service === 'powerapi') {
if (isset($_GET['county'])) {
try {
$query = "
SELECT DISTINCT ON (county, state)
WITH latest_update AS (
SELECT MAX(update) as max_update FROM countyoutages
)
SELECT
county,
state,
SUM(outages) as outage,
update as time,
MAX(update) as time,
SUM(served) as served,
ROUND(CAST((SUM(outages)::FLOAT / SUM(served)) * 100 AS NUMERIC), 2) as perout
ROUND(
CASE
WHEN SUM(served) > 0 THEN (SUM(outages)::FLOAT / SUM(served)) * 100
ELSE 0
END::NUMERIC, 2
) as perout
FROM countyoutages
WHERE update = (SELECT MAX(update) FROM countyoutages)
AND cwa = $1
GROUP BY county, state, update
JOIN latest_update ON countyoutages.update = latest_update.max_update
WHERE cwa = $1
GROUP BY county, state
ORDER BY county, state;
";
$result = pg_query_params($dbconn, $query, ['RLX']);

View File

@@ -1,35 +0,0 @@
<html>
<head>
<style>
body {
overflow-y: hidden;
overflow-x: hidden;
border: 0;
padding:0px;
margin:0px;
}
iframe{
display: block; /* iframes are inline by default */
height: 100vh; /* Set height to 100% of the viewport height */
width: 100vw; /* Set width to 100% of the viewport width */
border: 0; /* Remove default border */
padding:0px;
margin:0px;
}
</style>
</head>
<script>
setTimeout(function(){
window.location.reload(1);
}, 30000*60);
</script>
<body>
<iframe src="https://www.youtube.com/embed/PRB70sO5MZM?autoplay=1&mute=1" title="YouTube video player" frameborder="0" marginheight="0" marginwidth="0" allow="autoplay; clipboard-write; encrypted-media; web-share" allowfullscreen></iframe>
</body>
</html>