Skip to content

Commit

Permalink
Fix/12 (#13)
Browse files Browse the repository at this point in the history
* set a default if entsoe api has no data

* format copilot

* set eco values to 0 if sum value is empty

* set eco values and sum to -1 if sum value is empty

* merge workflows from main
  • Loading branch information
eumel8 authored Feb 6, 2024
1 parent 830f0d5 commit d0e27d9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions flask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,18 @@ 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 = -1
#######################################
# 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_sum = -1
result_fos = -1
#######################################
# CO2 gramm/watt second
#######################################
Expand Down

0 comments on commit d0e27d9

Please sign in to comment.