Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
2.7.0 (unreleased)
------------------

- #53 Fix AttributeError for containers with more than 25 rows
- #52 Migrate Storage Root Folder to DX
- #51 JS->DX compatibility
- #50 Migrate storage samples container to DX
Expand Down
19 changes: 15 additions & 4 deletions src/senaite/storage/content/storage_layout_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,21 @@ def get_alpha_row(self, row):
"""Returns the alpha part for the passed in row
"""
alphabet = string.ascii_uppercase
num, idx = divmod(int(row), len(alphabet))
if num:
return self.get_alpha_column(num - 1) + alphabet[idx]
return alphabet[idx]
def alpha(num):
"""Converts the given number to alphabetical letter(s).
alpha(1) == 'A'
alpha(26) == 'Z'
alpha(27) == 'AA'
alpha(28) == 'AB'
"""
if num == 0:
return ""
prefix = alpha((num - 1) // len(alphabet))
letter = chr((num - 1) % len(alphabet) + ord(alphabet[0]))
return "%s%s" % (prefix, letter)

# row is a position, starting from 0, so we need to add 1
return alpha(row + 1)

def position_to_alpha(self, row, column):
"""Returns a position in alphanumeric format (e.g A01)
Expand Down