Skip to content

Commit

Permalink
update purge_skipped method to only remove measures that have SKIP ar…
Browse files Browse the repository at this point in the history
…g set to True
  • Loading branch information
kflemin committed Sep 7, 2021
1 parent 46f9270 commit 3877137
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/buildingsync/makers/workflow_maker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -518,15 +518,24 @@ def deep_copy_workflow
# Removes unused measures from a workflow, where __SKIP__ == true
# @param workflow [Hash] a hash of the openstudio workflow, typically after a deep
# copy is made and the measures are configured for the specific scenario
# KAF: reworked to only delete measures with an explicit __SKIP__ == true
# (sometimes measure don't have a skip at all, assume we want to keep those)
def purge_skipped_from_workflow(workflow)
non_skipped = []
if !workflow.nil? && !workflow['steps'].nil? && workflow.key?('steps')
workflow['steps'].each do |step|
if !step.nil? && step.key?('arguments') && !step['arguments'].nil?
if step['arguments'].key?('__SKIP__') && step['arguments']['__SKIP__'] == false
if !step.nil? && step.key?('arguments')
if step['arguments'].nil?
# no arguments, keep anyway
non_skipped << step
elsif step['arguments'].key?('__SKIP__') && step['arguments']['__SKIP__'] == false
# skip is set to false, keep
non_skipped << step
elsif !step['arguments'].key?('__SKIP__')
# no "SKIP" argument, keep anyway
non_skipped << step
end
end
end
end
workflow['steps'] = non_skipped
end
Expand Down

0 comments on commit 3877137

Please sign in to comment.