Add remove_break method for db_helper.py
This commit is contained in:
@@ -166,6 +166,23 @@ class DBHelper():
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def remove_break(self, user_id: int, start_date: datetime.date) -> None:
|
||||||
|
"""Remove a callout based on user + date, which form the primary key in the db
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user_id (int): The Discord UUID of the user removing something from the db
|
||||||
|
callout (datetime.datetime): The date of the callout
|
||||||
|
"""
|
||||||
|
self.__CONN = connect_config(self._config)
|
||||||
|
self.__CONN.autocommit = True
|
||||||
|
cursor = self.__CONN.cursor()
|
||||||
|
|
||||||
|
cursor.execute("DELETE FROM breaks WHERE created_user = %s AND open_range = %s", (user_id, start_date))
|
||||||
|
self.__CONN.commit()
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def formatted_list_of_callouts(self, callouts: list) -> str:
|
def formatted_list_of_callouts(self, callouts: list) -> str:
|
||||||
"""Format the python list of callouts.
|
"""Format the python list of callouts.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user