Skip to content

Commit

Permalink
Change logic
Browse files Browse the repository at this point in the history
  • Loading branch information
haneslinger committed Feb 9, 2024
1 parent 6693cdb commit 927dc25
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/buildingsync/model_articulation/spatial_element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,17 @@ def process_bldg_and_system_type(building_and_system_types, occupancy_classifica
puts "Element ID: #{xget_id} started with occupancy_classification #{occupancy_classification} and total floor area: #{total_floor_area}"

# if building_and_system_types doesn't contain occupancy_classification, there's nothing we can do.
if !building_and_system_types.key?(:"#{occupancy_classification}")
occ_types = building_and_system_types[:"#{occupancy_classification}"]
if !occ_types
raise "BuildingSync Occupancy type #{occupancy_classification} is not available in the building_and_system_types.json dictionary"
end

# if theres only one, we chose it indiscriminately
# TODO: idk if we should do this but its what the tests want
if occ_types.length == 1
return sets_occupancy_bldg_system_types(occ_types[0])
end

# Try on each occ_type in the occupancy_classification for size
building_and_system_types[:"#{occupancy_classification}"]&.each do |occ_type|
# if occ_type has a specified floor area range, see if it matches up
Expand Down Expand Up @@ -227,8 +234,8 @@ def process_bldg_and_system_type(building_and_system_types, occupancy_classifica
end
end

# no occ_type fit! We gotta error. building_and_system_types.json shouldn't really error like this. check that file.
raise "BuildingSync Occupancy type #{occupancy_classification} is not available in the building_and_system_types.json dictionary"
# no occ_type fit! We gotta give up

This comment has been minimized.

Copy link
@ThibaultMarzullo

ThibaultMarzullo Feb 9, 2024

Contributor
  • we must give up
return false
end

# validate positive number excluding zero
Expand Down

0 comments on commit 927dc25

Please sign in to comment.