Skip to content

Commit

Permalink
fixed convert_size
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Nov 27, 2023
1 parent 39f68fb commit c2e842e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
3 changes: 1 addition & 2 deletions openatlas/display/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,7 @@ def format_date(value: Union[datetime, numpy.datetime64]) -> str:


def convert_size(size_bytes: int) -> str:
print(size_bytes)
if size_bytes == 0:
if size_bytes >= 0:
return "0 B" # pragma: no cover
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
i = int(math.floor(math.log(size_bytes, 1024)))
Expand Down
7 changes: 0 additions & 7 deletions openatlas/views/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,6 @@ def get_disk_space_info() -> Optional[dict[str, Any]]:
percent_free = 100 - math.ceil(stats.free / (stats.total / 100))
percent_files = math.ceil(files_size / (stats.total / 100))
other_files = stats.total - stats.free - files_size
print(files_size)
print(stats)
print(stats.free)
print(stats.total)
print(percent_free)
print(percent_files)
print(other_files)
return {
'total': convert_size(stats.total),
'project': convert_size(files_size),
Expand Down

0 comments on commit c2e842e

Please sign in to comment.