mirror of
https://github.com/stijndcl/didier.git
synced 2026-06-29 17:39:57 +02:00
Restructure backend
This commit is contained in:
parent
16f8fedd16
commit
6ba104758b
16 changed files with 108 additions and 42 deletions
|
|
@ -1,5 +1,8 @@
|
|||
from enum import IntEnum
|
||||
from typing import Dict, List
|
||||
|
||||
from database.db import session
|
||||
from database.models import CommandStats
|
||||
from functions.database import utils
|
||||
from functions.stringFormatters import leading_zero as lz
|
||||
import time
|
||||
|
|
@ -75,3 +78,17 @@ def _get_all():
|
|||
|
||||
cursor.execute("SELECT * FROM command_stats")
|
||||
return cursor.fetchall()
|
||||
|
||||
|
||||
def query_command_stats() -> List[Dict]:
|
||||
stats = []
|
||||
|
||||
for instance in session.query(CommandStats).order_by(CommandStats.day):
|
||||
stats.append({
|
||||
"day": instance.day,
|
||||
"commands": instance.commands,
|
||||
"slash_commands": instance.slash_commands,
|
||||
"context_menus": instance.context_menus
|
||||
})
|
||||
|
||||
return stats
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue