From 6c3d168efa79ddc7255c1be5beaa10c88185fd48 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 26 Feb 2024 13:27:12 +0100 Subject: [PATCH] Make sure rebuildCaseMetaData is always called --- .../Commands/RicUserDefinedCalculatorUi.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp index 7c555cf1f6..af596fcd5c 100644 --- a/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp +++ b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp @@ -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; @@ -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() ) {