diff --git a/functions/functions.php b/functions/functions.php index 942e6cc..d8c0d78 100644 --- a/functions/functions.php +++ b/functions/functions.php @@ -106,14 +106,15 @@ function get_grid_feed_by_month(mysqli $db, string $table_aggregation, string $t $price_result = $db->query($price_query); $price = []; - while ($row = $price_result->fetch_assoc()) { - $price[$row['year'] . '-' . str_pad($row['month'], 2, '0', STR_PAD_LEFT)] = $row['price']; + while ($price_row = $price_result->fetch_assoc()) { + $price[$price_row['year'] . '-' . str_pad($price_row['month'], 2, '0', STR_PAD_LEFT)] = $price_row['price']; } $grid_feed_by_month = []; - while ($row = $feed_result->fetch_assoc()) { - $grid_feed_by_month[$row['year'] . '-' . str_pad($row['month'], 2, '0', STR_PAD_LEFT)] = $row['SUM(grid_feed)'] * $price[$row['year'] . '-' . str_pad($row['month'], 2, '0', STR_PAD_LEFT)] / 100000; + $key = $row['year'] . '-' . str_pad($row['month'], 2, '0', STR_PAD_LEFT); + $price[$key] = $price[$key] ?? 0; + $grid_feed_by_month[$key] = $row['SUM(grid_feed)'] * $price[$key] / 100000; } return $grid_feed_by_month; diff --git a/public/css/layout.css b/public/css/layout.css index 6e9e6fe..4a604b0 100644 --- a/public/css/layout.css +++ b/public/css/layout.css @@ -47,6 +47,7 @@ button, .button { color: rgb(0, 0, 0); font-size: 1.3rem; padding: 8px 0; + cursor: pointer; } #chart-container { diff --git a/public/production.php b/public/production.php index ccd2832..bc93c3e 100644 --- a/public/production.php +++ b/public/production.php @@ -45,11 +45,11 @@ $chosen_date_time = new DateTime($chosen_date);