1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 13:35:23 +02:00

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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 326 additions and 32 deletions

View file

@ -6,5 +6,6 @@ from .group_migration import *
from .group_permissions import *
from .group_preferences import *
from .group_shopping_list import *
from .group_statistics import *
from .invite_token import *
from .webhook import *

View file

@ -0,0 +1,26 @@
from mealie.pkgs.stats import fs_stats
from mealie.schema._mealie import MealieModel
class GroupStatistics(MealieModel):
total_recipes: int
total_users: int
total_categories: int
total_tags: int
total_tools: int
class GroupStorage(MealieModel):
used_storage_bytes: int
used_storage_str: str
total_storage_bytes: int
total_storage_str: str
@classmethod
def bytes(cls, used_storage_bytes: int, total_storage_bytes: int) -> "GroupStorage":
return cls(
used_storage_bytes=used_storage_bytes,
used_storage_str=fs_stats.pretty_size(used_storage_bytes),
total_storage_bytes=total_storage_bytes,
total_storage_str=fs_stats.pretty_size(total_storage_bytes),
)