mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
#14542 Summary: Assign unique case ids when importing multiple cases
Summary cases are created and given a case id before they are added to the project. The id search only sees cases already in the project, so every case in a batch import was given the same id. The Data Sources tree stores the owning case id in each summary address, and all lookups resolve to the first case with that id. Selecting the same vector from several cases therefore produced a single curve, and dropping a vector from one of the other cases hit the duplicate check and did nothing.
This commit is contained in:
1 parent
5e17f9986d
commit
6d7959d150
4 files changed
+48
-9
No files matched your search
@@ -555,15 +555,23 @@ void RimProject::setProjectFileNameAndUpdateDependencies( const QString& project
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::assignCaseIdToSummaryCase( RimSummaryCase* summaryCase )
|
||||
{
|
||||
if ( summaryCase )
|
||||
{
|
||||
int nextValidId = 1;
|
||||
for ( RimSummaryCase* s : allSummaryCases() )
|
||||
{
|
||||
nextValidId = std::max( nextValidId, s->caseId() + 1 );
|
||||
}
|
||||
assignCaseIdsToSummaryCases( { summaryCase } );
|
||||
}
|
||||
|
||||
summaryCase->setCaseId( nextValidId );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::assignCaseIdsToSummaryCases( const std::vector<RimSummaryCase*>& summaryCases )
|
||||
{
|
||||
int nextValidId = 1;
|
||||
for ( RimSummaryCase* s : allSummaryCases() )
|
||||
{
|
||||
nextValidId = std::max( nextValidId, s->caseId() + 1 );
|
||||
}
|
||||
|
||||
for ( RimSummaryCase* summaryCase : summaryCases )
|
||||
{
|
||||
if ( summaryCase ) summaryCase->setCaseId( nextValidId++ );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user