Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
Fixed broken operands
Browse files Browse the repository at this point in the history
  • Loading branch information
vasll committed Apr 29, 2023
1 parent e0c0ae1 commit b022ee9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions db/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def get_guild_leaderboard(guild_id: int) -> CursorResult:
))
return result

async def get_guild(guild_id: int) -> Guild | None:
async def get_guild(guild_id: int) -> Guild:
""" Gets a Guild ORM from the db or None if it doesn't exist """
async with async_session() as session:
result = await session.execute(
Expand All @@ -67,15 +67,15 @@ async def update_guild(guild_id, tasks_channel_id, default_task_title) -> None:
db_guild.default_task_title = default_task_title
await session.commit()

async def get_task(task_message_id: int) -> Task | None:
async def get_task(task_message_id: int) -> Task:
""" Gets a task from the db """
async with async_session() as session:
result = await session.execute(
select(Task).filter_by(task_message_id=task_message_id).limit(1)
)
return result.scalars().first()

async def get_users_tasks(user_id: int, task_id: int) -> UsersTasks | None:
async def get_users_tasks(user_id: int, task_id: int) -> UsersTasks:
""" Gets a UsersTasks ORM from the db """
async with async_session() as session:
result = await session.execute(
Expand Down Expand Up @@ -104,7 +104,7 @@ async def update_users_tasks(users_tasks: UsersTasks, is_completed: bool, update
db_users_tasks.updated_at = updated_at
await session.commit()

async def get_guild_task_count(guild_id: int) -> int | None:
async def get_guild_task_count(guild_id: int) -> int:
""" Counts all the tasks from a guild and returns that as an int if query is successful"""
async with async_session() as session:
result = await session.execute(text(
Expand All @@ -116,7 +116,7 @@ async def get_guild_task_count(guild_id: int) -> int | None:
))
return result.first()[0]

async def get_task_count() -> int | None:
async def get_task_count() -> int:
""" Returns the task count of ALL the tasks stored in the db """
async with async_session() as session:
result = await session.execute(text(
Expand All @@ -125,7 +125,7 @@ async def get_task_count() -> int | None:
return result.first()[0]


async def get_completed_count(task_id: int, is_completed: bool) -> int | None:
async def get_completed_count(task_id: int, is_completed: bool) -> int:
""" Gets the count of how many users have completed or not a task based on its task_id """
async with async_session() as session:
result = await session.execute(text(
Expand Down

0 comments on commit b022ee9

Please sign in to comment.