Skip to content
Snippets Groups Projects
Unverified Commit 83134aa4 authored by Martyn Gigg's avatar Martyn Gigg Committed by GitHub
Browse files

Merge pull request #22803 from mantidproject/22625-fit-history-incomplete

Algorithm history includes dynamic input properties.
parents 885caf22 17b945be
No related branches found
No related tags found
No related merge requests found
......@@ -169,10 +169,11 @@ ScriptBuilder::buildAlgorithmString(AlgorithmHistory_const_sptr algHistory) {
freshPropNames.insert(propFresh->name());
}
// remove properties that are not present on a fresh algorithm
// remove output properties that are not present on a fresh algorithm
// i.e. remove dynamically added properties
for (auto prop_iter = props.begin(); prop_iter != props.end();) {
if (freshPropNames.find((*prop_iter)->name()) == freshPropNames.end()) {
if (freshPropNames.find((*prop_iter)->name()) == freshPropNames.end() &&
(*prop_iter)->direction() == Kernel::Direction::Output) {
prop_iter = props.erase(prop_iter);
} else {
++prop_iter;
......
......@@ -175,6 +175,10 @@ class ScriptBuilderTest : public CxxTest::TestSuite {
const std::string summary() const override {
return "AlgorithmWithDynamicProperty";
}
void afterPropertySet(const std::string &name) override {
if (name == "InputWorkspace")
declareProperty("DynamicInputProperty", "");
}
void init() override {
declareProperty(make_unique<WorkspaceProperty<MatrixWorkspace>>(
......@@ -435,7 +439,7 @@ public:
std::string result =
"AlgorithmWithDynamicProperty(InputWorkspace='test_input_workspace', "
"OutputWorkspace='test_output_workspace', PropertyA='A', "
"PropertyB='B')\n";
"PropertyB='B', DynamicInputProperty='C')\n";
boost::shared_ptr<WorkspaceTester> input =
boost::make_shared<WorkspaceTester>();
AnalysisDataService::Instance().addOrReplace("test_input_workspace", input);
......@@ -447,6 +451,7 @@ public:
alg->setProperty("InputWorkspace", input);
alg->setProperty("PropertyA", "A");
alg->setProperty("PropertyB", "B");
alg->setProperty("DynamicInputProperty", "C");
alg->setPropertyValue("OutputWorkspace", "test_output_workspace");
alg->execute();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment