|
|
|
|
@ -58,11 +58,12 @@ async def get_charts(
|
|
|
|
|
|
|
|
|
|
chart_data = results.scalars().all()
|
|
|
|
|
bep_year = None
|
|
|
|
|
previous_year = 0
|
|
|
|
|
previous_total_cost = 0
|
|
|
|
|
previous_revenue = 0
|
|
|
|
|
bep_total_lcc = 0
|
|
|
|
|
|
|
|
|
|
for item in chart_data:
|
|
|
|
|
for idx, item in enumerate(chart_data):
|
|
|
|
|
total_cost = (
|
|
|
|
|
item.chart_capex_annualized
|
|
|
|
|
+ item.chart_oem_annualized
|
|
|
|
|
@ -74,12 +75,17 @@ async def get_charts(
|
|
|
|
|
if (previous_total_cost > previous_revenue and total_cost < revenue) or (
|
|
|
|
|
previous_total_cost < previous_revenue and total_cost > revenue
|
|
|
|
|
):
|
|
|
|
|
bep_total_lcc = total_cost
|
|
|
|
|
bep_year = item.tahun
|
|
|
|
|
if total_cost < revenue:
|
|
|
|
|
bep_total_lcc = previous_total_cost
|
|
|
|
|
bep_year = previous_year
|
|
|
|
|
else:
|
|
|
|
|
bep_total_lcc = total_cost
|
|
|
|
|
bep_year = item.tahun
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
previous_total_cost = total_cost
|
|
|
|
|
previous_revenue = revenue
|
|
|
|
|
previous_year = item.tahun
|
|
|
|
|
|
|
|
|
|
return chart_data, bep_year, bep_total_lcc
|
|
|
|
|
|
|
|
|
|
|