Skip to content

Commit

Permalink
Make sure rebuildCaseMetaData is always called
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Feb 26, 2024
1 parent fd617f6 commit 6c3d168
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ bool RicUserDefinedCalculatorUi::parseExpression() const
{
notifyCalculatedNameChanged( m_currentCalculation()->id(), currentCurveName );
}

// Always rebuild the case meta data after parsing the expression. A change in name or change in result type will require rebuild of
// case metadata. The rebuild is considered lightweight and should not be a performance issue.
calculationCollection()->rebuildCaseMetaData();
}

return true;
Expand Down Expand Up @@ -218,17 +222,7 @@ bool RicUserDefinedCalculatorUi::calculate() const
{
if ( m_currentCalculation() )
{
QString previousCurveName = m_currentCalculation->description();
if ( !m_currentCalculation()->parseExpression() )
{
return false;
}

QString currentCurveName = m_currentCalculation->description();
if ( previousCurveName != currentCurveName )
{
notifyCalculatedNameChanged( m_currentCalculation()->id(), currentCurveName );
}
if ( !parseExpression() ) return false;

if ( !m_currentCalculation()->preCalculate() )
{
Expand Down

0 comments on commit 6c3d168

Please sign in to comment.