Skip to content

Commit

Permalink
set a default if entsoe api has no data
Browse files Browse the repository at this point in the history
  • Loading branch information
eumel8 committed Feb 5, 2024
1 parent 0c58f59 commit 9aa25fe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions flask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,17 @@ def metrics():
#######################################
# Bio efficience
#######################################
result_eco = (int(result_b01) + int(result_b09) + int(result_b10) + int(result_b11) + int(result_b12) + int(result_b16) + int(result_b17) + int(result_b18) + int(result_b19)) / int(result_sum)
if result_sum:
result_eco = (int(result_b01) + int(result_b09) + int(result_b10) + int(result_b11) + int(result_b12) + int(result_b16) + int(result_b17) + int(result_b18) + int(result_b19)) / int(result_sum)
else:
result_eco = 0.99
#######################################
# Fossil part
#######################################
result_fos = (int(result_b02) + int(result_b04) + int(result_b05)) / int(result_sum)
if result_sum:
result_fos = (int(result_b02) + int(result_b04) + int(result_b05)) / int(result_sum)
else:
result_fos = 0.01
#######################################
# CO2 gramm/watt second
#######################################
Expand Down

0 comments on commit 9aa25fe

Please sign in to comment.