Skip to content

Commit

Permalink
Update paths.py
Browse files Browse the repository at this point in the history
Update paths.py
  • Loading branch information
baseplate-admin committed Feb 23, 2024
1 parent 2917652 commit 8d4df6b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions django_ltree/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math
from itertools import product

from .fields import PathValue
# from .fields import PathValue


class PathGenerator(object):
Expand Down Expand Up @@ -48,9 +48,12 @@ def guess_the_label_size(path_size: int, combination_size: int) -> int:
last = possible_cominations
calculated_path_size += possible_cominations

if calculated_path_size > path_size and label_size != 0:
if calculated_path_size > (path_size + 1) and label_size != 0:
break

label_size += 1

return label_size


print(PathGenerator.guess_the_label_size(62, 62))

0 comments on commit 8d4df6b

Please sign in to comment.