feat: add group statistics on profile page

* resolve file not found error and add constants

* add group stats and storage functionality

* generate new types

* add statistics and storage cap graphs

* fix: add loadFood query param #1103

* refactor to flex view
This commit is contained in:
Hayden
2022-03-27 15:12:18 -08:00
committed by GitHub
parent b57e42a3b3
commit 1e90dc2022
13 changed files with 326 additions and 32 deletions

View File

@@ -1,6 +1,9 @@
import os
from pathlib import Path
megabyte = 1_048_576
gigabyte = 1_073_741_824
def pretty_size(size: int) -> str:
"""
@@ -23,7 +26,11 @@ def get_dir_size(path: Path | str) -> int:
"""
Get the size of a directory
"""
total_size = os.path.getsize(path)
try:
total_size = os.path.getsize(path)
except FileNotFoundError:
return 0
for item in os.listdir(path):
itempath = os.path.join(path, item)
if os.path.isfile(itempath):