Skip to content

Commit

Permalink
fix(model): Ensure exception does not happen for model with no Rooms
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed May 29, 2024
1 parent 6901399 commit d4a608f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions honeybee_doe2/properties/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ def apply_properties_from_dict(self, data):
assert 'doe2' in data['properties'], \
'Dictionary possesses no ModelDoe2Properties.'
room_doe2_dicts = []
for room_dict in data['rooms']:
try:
room_doe2_dicts.append(room_dict['properties']['doe2'])
except KeyError:
room_doe2_dicts.append(None)
for room, r_dict in zip(self.host.rooms, room_doe2_dicts):
if r_dict is not None:
room.properties.doe2.apply_properties_from_dict(r_dict)
if 'rooms' in data and data['rooms'] is not None:
for room_dict in data['rooms']:
try:
room_doe2_dicts.append(room_dict['properties']['doe2'])
except KeyError:
room_doe2_dicts.append(None)
for room, r_dict in zip(self.host.rooms, room_doe2_dicts):
if r_dict is not None:
room.properties.doe2.apply_properties_from_dict(r_dict)

def ToString(self):
return self.__repr__()
Expand Down

0 comments on commit d4a608f

Please sign in to comment.