| 833 | } |
| 834 | |
| 835 | Json::Value OSRunner::getPastStepValuesForMeasure(const std::string& measureName) const { |
| 836 | Json::Value step_values(Json::objectValue); |
| 837 | for (const MeasureStep& step : subsetCastVector<MeasureStep>(m_workflow.workflowSteps())) { |
| 838 | boost::optional<WorkflowStepResult> stepResult_ = step.result(); |
| 839 | if (!stepResult_ || !stepResult_->stepResult() || stepResult_->stepResult().get() != StepResult::Success) { |
| 840 | continue; |
| 841 | } |
| 842 | // TODO: should we match on any of these three? |
| 843 | if (istringEqual(measureName, step.measureDirName())) { // The directory name, eg `IncreaseWallRValue` |
| 844 | LOG(Trace, "Step matches on measureDirName"); |
| 845 | } else if (auto s_ = step.name(); s_.is_initialized() && istringEqual(measureName, *s_)) { // An optional, abritrary one |
| 846 | LOG(Trace, "Step matches on name"); |
| 847 | } else if (auto s_ = stepResult_->measureName(); |
| 848 | s_.is_initialized() |
| 849 | && istringEqual(measureName, *s_)) { // The xml one, eg `increase_insulation_r_value_for_exterior_walls_by_percentage` |
| 850 | LOG(Trace, "Step matches on Step Result's measureName"); |
| 851 | } else { |
| 852 | continue; |
| 853 | } |
| 854 | |
| 855 | for (const WorkflowStepValue& step_value : stepResult_->stepValues()) { |
| 856 | Json::Value root = step_value.toJSON(); |
| 857 | if (auto value = root["value"]) { |
| 858 | step_values[step_value.name()] = value; |
| 859 | } |
| 860 | } |
| 861 | break; |
| 862 | } |
| 863 | return step_values; |
| 864 | } |
| 865 | |
| 866 | Json::Value OSRunner::getPastStepValuesForName(const std::string& stepName) const { |
| 867 | // This function aims to replace OsLib_HelperMethods.check_upstream_measure_for_arg |