handling aggregations storage to db

This commit is contained in:
Khalim Conn-Kowlessar 2024-07-09 23:30:09 +01:00
parent e12ff81aaa
commit 36718ab3be
2 changed files with 2 additions and 2 deletions

View file

@ -11,7 +11,7 @@ def aggregate_portfolio_recommendations(
session.query(
func.sum(Recommendation.estimated_cost).label("cost"),
func.sum(Recommendation.total_work_hours).label("total_work_hours"),
func.sum(Recommendation.adjusted_heat_demand).label("energy_savings"),
func.sum(Recommendation.kwh_savings).label("energy_savings"),
func.sum(Recommendation.co2_equivalent_savings).label("co2_equivalent_savings"),
func.sum(Recommendation.energy_cost_savings).label("energy_cost_savings"),
)

View file

@ -129,7 +129,7 @@ def extract_portfolio_aggregation_data(
pre_retrofit_energy_consumption = p.current_adjusted_energy
post_retrofit_energy_consumption = p.current_adjusted_energy - sum(
[r["adjusted_heat_demand"] for r in default_recommendations]
[r["kwh_savings"] for r in default_recommendations]
)
# Add up energy savings