Skip to content

Commit

Permalink
fix bug introduced in last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
verginer committed Mar 17, 2018
1 parent d4d2111 commit 595fc2d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pathpy/classes/multi_order_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def max_order(self):
"""the current maximum order of the multi-order model"""
orders = list(self.layers.keys())
if not orders:
return -1
return None
else:
return max(orders)

Expand Down Expand Up @@ -129,13 +129,14 @@ def add_layers(self, max_order):
"""
from pathpy import ENABLE_MULTICORE_SUPPORT

current_max_order = self.max_order if self.max_order else -1
if max_order < 0:
raise PathpyError("max_order must be a positive integer not %d" % max_order)

if max_order <= self.max_order:
if max_order <= current_max_order:
Log.add("Layers up to order %d already added. Nothing changed." % self.max_order)

orders_to_add = list(range(self.max_order+1, max_order+1))
orders_to_add = list(range(current_max_order+1, max_order+1))
if len(orders_to_add) > 1 and ENABLE_MULTICORE_SUPPORT:
self.__add_layers_parallel(orders_to_add)
else:
Expand Down

0 comments on commit 595fc2d

Please sign in to comment.