From 60399803ad178a436bc7f51be8af1d4d8d999191 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 9 Jan 2015 12:15:12 +0100 Subject: [PATCH] In loadentities command fix off by one error when computing new bounds for entities tree --- polynum/base/management/commands/loadentities.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/polynum/base/management/commands/loadentities.py b/polynum/base/management/commands/loadentities.py index 37947de..6bba5a5 100644 --- a/polynum/base/management/commands/loadentities.py +++ b/polynum/base/management/commands/loadentities.py @@ -204,7 +204,7 @@ class Command(BaseCommand): if self.old_left_bound > 2*(len(parser.entities)+Entity.objects.all().count())-1: start_bound = 0 else: - start_bound = self.old_right_bound + start_bound = self.old_right_bound+1 end_bound = self.allocate_instances(root, start_bound, instances, (root.code,)) print left_bounds = [i.left_bound for i in instances if not i.id or i.reused] @@ -227,8 +227,8 @@ class Command(BaseCommand): print i = 0 for entity in filter(lambda x: bool(x.id) and not x.reused, self.old_instances.values()): - entity.left_bound = end_bound+i*2 - entity.right_bound = end_bound+i*2+1 + entity.left_bound = end_bound+i*2+1 + entity.right_bound = end_bound+i*2+2 entity.is_active = False entity.save() i += 1