Janitor : Trim unit text for summary vectors

This commit is contained in:
Magne Sjaastad
2021-12-29 14:02:57 +01:00
parent 9023b01cfa
commit db8209d23a
3 changed files with 23 additions and 8 deletions

View File

@@ -302,8 +302,20 @@ RifSummaryReaderInterface* RifReaderEclipseSummary::currentSummaryReader() const
std::string RifReaderEclipseSummary::unitName( const RifEclipseSummaryAddress& resultAddress ) const
{
auto reader = currentSummaryReader();
if ( reader )
{
auto nativeName = resultAddress.quantityName();
auto stringToRemove = RifReaderEclipseSummary::differenceIdentifier();
if ( RiaStdStringTools::endsWith( nativeName, stringToRemove ) )
{
nativeName = nativeName.substr( 0, nativeName.size() - stringToRemove.size() );
}
if ( reader ) return reader->unitName( resultAddress );
RifEclipseSummaryAddress adr( resultAddress );
adr.setQuantityName( nativeName );
return reader->unitName( adr );
}
return "";
}