Skip to content

Commit 8fcb76f

Browse files
committed
On missing parent print only problematic item
1 parent dede965 commit 8fcb76f

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

importer/src/hierarchy.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,12 @@ void Hierarchy::print(bool full) const
183183
std::cout << c << " ";
184184
std::cout << "\n";
185185
}
186+
187+
void Hierarchy::print_root_with_parent_id(hindex parent_id) const
188+
{
189+
for (auto item : root_items())
190+
{
191+
if (item->parent_id() == parent_id)
192+
item->print_item(0);
193+
}
194+
}

importer/src/hierarchy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class Hierarchy
3333
std::set<std::string> get_root_countries() const;
3434

3535
void print(bool full = true) const;
36+
void print_root_with_parent_id(hindex parent_id) const;
3637

3738
private:
3839
std::deque<std::shared_ptr<HierarchyItem> > root_items() const;

importer/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ int main(int argc, char *argv[])
208208

209209
if (!found)
210210
{
211-
std::cerr << "Missing parent with ID " << parent << ". Stopping import\n";
212-
hierarchy.print(false);
211+
std::cerr << "Missing parent with ID " << parent << " . Stopping import\n";
212+
hierarchy.print_root_with_parent_id(parent);
213213
return -1;
214214
}
215215

0 commit comments

Comments
 (0)