Skip to content

Commit

Permalink
Carbon Update - Now support files including failed test
Browse files Browse the repository at this point in the history
  • Loading branch information
7h3Rabbit committed Jan 11, 2025
1 parent 2c06f06 commit bf0a4d8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions helpers/carbon_rating_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,19 @@ def update_carbon_percentiles(argv):
generated_date = False
co2s = []

test_index = -1
for test in tests:
test_index += 1
if not generated_date:
generated_date = datetime.fromisoformat(
test[FIELD_INDEX_DATE]).strftime('%Y-%m-%d')

data = test[FIELD_INDEX_DATA]
if 'co2' not in data:
nice = json.dumps(test, indent=3)
print(f'WARNING, ignored testresult because it was missing co2 data, index {test_index}. Test result:', nice)
continue

co2s.append(data['co2'])

if not generated_date:
Expand Down

0 comments on commit bf0a4d8

Please sign in to comment.