mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 00:27:41 +01:00
complete updating the endpoints and models
This commit is contained in:
@@ -11,25 +11,28 @@ class DBStatsHandler(DBBaseHandler):
|
||||
@begin_session
|
||||
def get_platforms_count(self, session: Session = None) -> int:
|
||||
"""Get the number of platforms with any roms."""
|
||||
return session.scalar(
|
||||
select(func.count(distinct(Rom.platform_id))).select_from(Rom)
|
||||
return (
|
||||
session.scalar(
|
||||
select(func.count(distinct(Rom.platform_id))).select_from(Rom)
|
||||
)
|
||||
or 0
|
||||
)
|
||||
|
||||
@begin_session
|
||||
def get_roms_count(self, session: Session = None) -> int:
|
||||
return session.scalar(select(func.count()).select_from(Rom))
|
||||
return session.scalar(select(func.count()).select_from(Rom)) or 0
|
||||
|
||||
@begin_session
|
||||
def get_saves_count(self, session: Session = None) -> int:
|
||||
return session.scalar(select(func.count()).select_from(Save))
|
||||
return session.scalar(select(func.count()).select_from(Save)) or 0
|
||||
|
||||
@begin_session
|
||||
def get_states_count(self, session: Session = None) -> int:
|
||||
return session.scalar(select(func.count()).select_from(State))
|
||||
return session.scalar(select(func.count()).select_from(State)) or 0
|
||||
|
||||
@begin_session
|
||||
def get_screenshots_count(self, session: Session = None) -> int:
|
||||
return session.scalar(select(func.count()).select_from(Screenshot))
|
||||
return session.scalar(select(func.count()).select_from(Screenshot)) or 0
|
||||
|
||||
@begin_session
|
||||
def get_total_filesize(self, session: Session = None) -> int:
|
||||
|
||||
Reference in New Issue
Block a user