Change some styling. Fix undefined array_key in functions and show overview values in yearly view.
Some checks failed
Build power-consumtion image / Build-and-release-image (push) Failing after 26s
Some checks failed
Build power-consumtion image / Build-and-release-image (push) Failing after 26s
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user