Skip to content

Commit e677f15

Browse files
committed
Refactor getCount method to streamline sheet availability checks and improve return logic.
1 parent 8f61dba commit e677f15

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/ImportOds.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,13 @@ std::pair<bool, QStringList> ImportOds::getSheetNamesFromZipFile()
181181
std::pair<bool, int> ImportOds::getCount(const QString& sheetName,
182182
const QHash<QString, int>& countMap)
183183
{
184-
if (!isSheetAvailable(sheetName))
185-
return {false, {}};
186-
187-
if (const auto it{countMap.find(sheetName)}; it != countMap.end())
188-
return {true, it.value()};
184+
if (const auto it{countMap.constFind(sheetName)}; it != countMap.constEnd())
185+
return {true, *it};
189186

190-
if (!analyzeSheet(sheetName))
191-
return {false, 0};
187+
if (isSheetAvailable(sheetName) && analyzeSheet(sheetName))
188+
return {true, countMap.value(sheetName)};
192189

193-
return {true, countMap.find(sheetName).value()};
190+
return {false, {}};
194191
}
195192

196193
std::pair<bool, QStringList> ImportOds::retrieveColumnNames(

0 commit comments

Comments
 (0)