Skip to content

Fix/floor area building first - #22

Merged
kflemin merged 4 commits into
developfrom
fix/floor-area-building-first
Nov 12, 2026
Merged

kflemin merged 4 commits into
developfrom
fix/floor-area-building-first

Conversation

@kflemin

@kflemin kflemin commented Nov 10, 2026

Copy link
Copy Markdown
Contributor
  • get_total_floor_area checked Site/FloorAreas before Building/FloorAreas, so a Site value overrode the Building's own floor area. The method comment already said Building should come first. BuildingSync tools should use the most specific value when both are present.
  • buildingsync_reader_spec.rb failed when run on its own (undefined method 'BOSS_logger' for BOSS:Module). The reader relied on other files to load the logger and constants.

What this does

  • Checks Building floor area first and falls back to Site.
  • Adds specs for Building only, Site only, and both present (the previously empty get_total_floor_area block).
  • Updates the README input table to say Building wins when both are present.
  • Requires BOSS/boss_logger and BOSS/constants directly in buildingsync_reader.rb.

kflemin and others added 2 commits November 10, 2026 12:53
get_total_floor_area checked Site FloorAreas before Building, so a
Site value overrode the Building's own value. Check the more specific
Building first and fall back to Site, matching the method comment.

Add specs for Building only, Site only, and both present.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reader calls BOSS.BOSS_logger and uses ASHRAE90_1 and other
constants, but relied on other files to load them. Running
buildingsync_reader_spec.rb on its own failed with "undefined method
`BOSS_logger' for BOSS:Module". Require both directly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The unguarded Building lookup raises NoMethodError for Site-only documents before reaching the area fallback, and the new spec’s empty Building element leaves this regression untested.

1 open issue
What changed in this PR

This PR makes BuildingSync floor-area selection prefer the Building’s value over the Site’s value and adds direct dependencies for standalone reader use.

Changes:

  • Checks Building floor area first, falling back to Site.
  • Adds specs for Building-only values, Site fallback, and precedence when both have values.
  • Documents the precedence and explicitly requires the logger and constants.
File Description
spec/​tests/​unit/​buildingsync_reader_spec.rb Adds three floor-area selection specs.
README.md Documents Building-over-Site precedence.
lib/​BOSS/​buildingsync_reader/​buildingsync_reader.rb Reorders floor-area lookup and adds direct dependency requires.

Review effort: Balanced

# check building floor area
BOSS.BOSS_logger.info("#{"|\t"*num_indent}- checking building for total floor area...")
building_floor_areas_xml = @building_xml.elements["#{@ns}FloorAreas"]
building_area = !building_floor_areas_xml.nil? ? _get_total_floor_area_from_floor_areas_xml(building_floor_areas_xml, num_indent+1) : 0
BOSS.BOSS_logger.info("#{"|\t"*num_indent} building floor area is #{building_area}")
return building_area if building_area > 0

# check site floor area
BOSS.BOSS_logger.info("#{"|\t"*num_indent}- checking site for total floor area...")
site_floor_areas_xml = @site_xml.elements["#{@ns}FloorAreas"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in bcf2317 by guarding the Building floor-area lookup and adding a Site-only regression spec.

@kflemin
kflemin merged commit 1929a26 into develop Nov 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants