Commit 508445cb authored by Martin Marinov's avatar Martin Marinov

Set the number of done children of Progress::Node in Context::entry_node()...

Set the number of done children of Progress::Node in Context::entry_node() instead of Context::exit_node() to report the correct completed stage number while the child node is active.
parent e4230078
......@@ -88,9 +88,18 @@ void Context::enter_node(Node* const _node)
_node->done_chld_nmbr_ = 0;
if (phony()) // no active node, ...
root_node_ = _node; // ... so the node to enter is the root
else // the current active node becomes the parent of the node to enter
else // the currently active node becomes the parent of the node to enter
{
_node->prnt_ = actv_node_; // make the parent the active node
int done_chld_nmbr = 0;
// seek the "active" child in the parent's list of children
auto chld = actv_node_->child();
for (; chld != nullptr && chld != _node; chld = chld->next())
++done_chld_nmbr;
DEB_error_if(chld != _node, "Could not find the child node " << _node->name
<< " in the children list of the parent node " << actv_node_->name);
actv_node_->done_chld_nmbr_ = done_chld_nmbr; // update the parent data
}
if (logging()) // record the entry time
{
if (actv_node_ != nullptr) // add the elapsed time to the active node
......@@ -133,21 +142,7 @@ void Context::exit_node()
actv_node_ = &phny_root_;
return;
}
int done_chld_nmbr = 0;
DEB_only(bool chld_fnd = false);
for (auto chld = prnt->child(); chld != nullptr; chld = chld->next())
{// seek the "active" child in the parent's list of children
++done_chld_nmbr;
if (chld == actv_node_) // found the active child which is just exiting
{
DEB_only(chld_fnd = true);
break;
}
}
DEB_error_if(!chld_fnd, "Could not find the child node " << actv_node_->name
<< " in the children list of the parent node " << prnt->name);
prnt->done_chld_nmbr_ = done_chld_nmbr; // update the parent data
++prnt->done_chld_nmbr_; // this node is now done as well
actv_node_ = prnt; // activate the parent
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment