diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index 9ec3a8fec3..e3c968a64c 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -151,10 +151,11 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector QTextStream stream(&exportFile); RifEclipseDataTableFormatter formatter(stream); + std::map completionData; + for (auto wellPath : wellPaths) { // Generate completion data - std::map completionData; if (exportSettings.includePerforations) { @@ -168,22 +169,21 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector std::vector fishbonesWellPathCompletionData = generateFishbonesWellPathCompdatValues(wellPath, exportSettings); appendCompletionData(&completionData, fishbonesWellPathCompletionData); } + } - // Merge map into a vector of values - std::vector completions; - for (auto& data : completionData) - { - completions.push_back(data.second); - } - // Sort by well name / cell index - std::sort(completions.begin(), completions.end()); - - // Print completion data - generateCompdatTable(formatter, completions); - if (exportSettings.includeWpimult) - { - generateWpimultTable(formatter, completions); - } + // Merge map into a vector of values + std::vector completions; + for (auto& data : completionData) + { + completions.push_back(data.second); + } + // Sort by well name / cell index + std::sort(completions.begin(), completions.end()); + // Print completion data + generateCompdatTable(formatter, completions); + if (exportSettings.includeWpimult) + { + generateWpimultTable(formatter, completions); } } diff --git a/ApplicationCode/ReservoirDataModel/RigCompletionData.cpp b/ApplicationCode/ReservoirDataModel/RigCompletionData.cpp index 066f15504a..6c6e758d06 100644 --- a/ApplicationCode/ReservoirDataModel/RigCompletionData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCompletionData.cpp @@ -87,10 +87,11 @@ RigCompletionData RigCompletionData::combine(const RigCompletionData& first, con //================================================================================================== bool RigCompletionData::operator<(const RigCompletionData& other) const { - if (m_wellName < other.m_wellName) - { - return true; + if (m_wellName != other.m_wellName) + { + return (m_wellName < other.m_wellName); } + return m_cellIndex < other.m_cellIndex; }