diff --git a/adbnx_adapter/adapter.py b/adbnx_adapter/adapter.py index 1c42602..2b61de7 100644 --- a/adbnx_adapter/adapter.py +++ b/adbnx_adapter/adapter.py @@ -345,7 +345,7 @@ def networkx_to_arangodb( bar_progress_task = bar_progress.add_task("Nodes", total=len(nx_nodes)) with Live(Group(bar_progress, spinner_progress)): - for i, (nx_id, nx_node) in enumerate(nx_nodes, 1): + for i, (nx_id, nx_node) in enumerate(nx_nodes): bar_progress.advance(bar_progress_task) # 1. Process NetworkX node @@ -360,7 +360,7 @@ def networkx_to_arangodb( ) # 2. Insert batch of nodes - if i % node_batch_size == 0: + if i and i % node_batch_size == 0: self.__insert_adb_docs( spinner_progress, adb_docs, use_async, **adb_import_kwargs ) @@ -385,7 +385,7 @@ def networkx_to_arangodb( bar_progress_task = bar_progress.add_task("Edges", total=len(nx_edges)) with Live(Group(bar_progress, spinner_progress)): - for i, (from_node_id, to_node_id, nx_edge) in enumerate(nx_edges, 1): + for i, (from_node_id, to_node_id, nx_edge) in enumerate(nx_edges): bar_progress.advance(bar_progress_task) # 1. Process NetworkX edge @@ -401,7 +401,7 @@ def networkx_to_arangodb( ) # 2. Insert batch of edges - if i % edge_batch_size == 0: + if i and i % edge_batch_size == 0: self.__insert_adb_docs( spinner_progress, adb_docs, use_async, **adb_import_kwargs ) diff --git a/tests/test_adapter.py b/tests/test_adapter.py index fe92a48..e4e045c 100644 --- a/tests/test_adapter.py +++ b/tests/test_adapter.py @@ -493,7 +493,7 @@ def assert_arangodb_data( has_one_vcol = len(adb_v_cols) == 1 has_one_ecol = len(adb_e_cols) == 1 - for i, (nx_id, nx_node) in enumerate(nx_g.nodes(data=True), 1): + for i, (nx_id, nx_node) in enumerate(nx_g.nodes(data=True)): col = ( adb_v_cols[0] if has_one_vcol