Skip to content

Commit

Permalink
Update views.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rathod-b committed Oct 22, 2024
1 parent bd6a0fb commit f012506
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions reoptjl/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,17 +1066,17 @@ def queryset_for_summary(api_metas,summary_dict:dict):
)
if len(utility) > 0:
for m in utility:

summary_dict[str(m.meta.run_uuid)]['focus'] = ''
if m.outage_start_time_step is None:
if len(m.outage_start_time_steps) == 0:
summary_dict[str(m.meta.run_uuid)]['focus'] = "Financial"
summary_dict[str(m.meta.run_uuid)]['focus'] += "Financial,"
else:
summary_dict[str(m.meta.run_uuid)]['focus'] = "Resilience"
summary_dict[str(m.meta.run_uuid)]['focus'] += "Resilience,"
summary_dict[str(m.meta.run_uuid)]['outage_duration'] = m.outage_durations[0] # all durations are same.
else:
# outage start timestep was provided, is 1 or more
summary_dict[str(m.meta.run_uuid)]['outage_duration'] = m.outage_end_time_step - m.outage_start_time_step + 1
summary_dict[str(m.meta.run_uuid)]['focus'] = "Resilience"
summary_dict[str(m.meta.run_uuid)]['focus'] += "Resilience,"

site = SiteOutputs.objects.filter(meta__run_uuid__in=run_uuids).only(
'meta__run_uuid',
Expand All @@ -1099,13 +1099,13 @@ def queryset_for_summary(api_metas,summary_dict:dict):
for m in site_inputs:
try: # can be NoneType
if m.renewable_electricity_min_fraction > 0:
summary_dict[str(m.meta.run_uuid)]['focus'] = "Clean-energy"
summary_dict[str(m.meta.run_uuid)]['focus'] += "Clean-energy,"
except:
pass # is NoneType

try: # can be NoneType
if m.renewable_electricity_max_fraction > 0:
summary_dict[str(m.meta.run_uuid)]['focus'] = "Clean-energy"
summary_dict[str(m.meta.run_uuid)]['focus'] += "Clean-energy,"
except:
pass # is NoneType

Expand All @@ -1119,10 +1119,10 @@ def queryset_for_summary(api_metas,summary_dict:dict):
if len(settings) > 0:
for m in settings:
if m.off_grid_flag:
summary_dict[str(m.meta.run_uuid)]['focus'] = "Off-grid"
summary_dict[str(m.meta.run_uuid)]['focus'] += "Off-grid,"

if m.include_climate_in_objective or m.include_health_in_objective:
summary_dict[str(m.meta.run_uuid)]['focus'] = "Clean-energy"
summary_dict[str(m.meta.run_uuid)]['focus'] += "Clean-energy,"

tariffInputs = ElectricTariffInputs.objects.filter(meta__run_uuid__in=run_uuids).only(
'meta__run_uuid',
Expand Down

0 comments on commit f012506

Please sign in to comment.