In loadentities command fix off by one error when computing new bounds for entities tree

This commit is contained in:
Benjamin Dauvergne 2015-01-09 12:15:12 +01:00
parent d43175e9b9
commit 60399803ad
1 changed files with 3 additions and 3 deletions

View File

@ -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