From 26276b0989545d9a306aa2d959542160647815e7 Mon Sep 17 00:00:00 2001 From: Gabriella Date: Fri, 17 Oct 2025 10:41:20 -0600 Subject: [PATCH] Add remove_break method for db_helper.py --- src/py/helper/db_helper.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/py/helper/db_helper.py b/src/py/helper/db_helper.py index 79e48c2..6bc482e 100644 --- a/src/py/helper/db_helper.py +++ b/src/py/helper/db_helper.py @@ -166,6 +166,23 @@ class DBHelper(): 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: """Format the python list of callouts.