From 43642590c2dfc408bf844dd06de0e1a377916d40 Mon Sep 17 00:00:00 2001 From: Abdelaziz Elrashed Date: Tue, 19 Nov 2024 15:27:44 +0300 Subject: [PATCH] =?UTF-8?q?=D8=AA=D8=AD=D8=B3=D9=8A=D9=86=20=D8=B1=D8=B3?= =?UTF-8?q?=D8=A7=D9=84=D8=A9=20=D8=A7=D9=84=D8=AE=D8=B7=D8=A3=20=D9=81?= =?UTF-8?q?=D9=8A=20=D8=B3=D8=AC=D9=84=20=D8=A7=D9=84=D8=B9=D9=85=D9=84?= =?UTF-8?q?=D9=8A=D8=A7=D8=AA=20=D9=81=D9=8A=20=D8=AC=D9=85=D9=8A=D8=B9=20?= =?UTF-8?q?=D8=A7=D9=84=D9=86=D9=85=D8=A7=D8=B0=D8=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zakat/zakat_tracker.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/zakat/zakat_tracker.py b/zakat/zakat_tracker.py index 70f4e72..5333c42 100644 --- a/zakat/zakat_tracker.py +++ b/zakat/zakat_tracker.py @@ -173,7 +173,7 @@ def sub(self, unscaled_value: float | int | Decimal, desc: str = '', account: in Raises: ValueError: The box transaction happened again in the same time. - ValueError: The log transaction happened again in the same time. + ValueError: The log transaction('xxx') happened again in the same time. ValueError: The created must be a str, was provided. """ @@ -198,7 +198,7 @@ def track(self, unscaled_value: float | int | Decimal = 0, desc: str = '', accou This function creates a new account if it doesn't exist, logs the transaction if logging is True, and updates the account's balance and box. Raises: - ValueError: The log transaction happened again in the same time. + ValueError: The log transaction('xxx') happened again in the same time. ValueError: The box transaction happened again in the same time. ValueError: The created must be a str, was provided. """ @@ -417,7 +417,7 @@ def transfer(self, unscaled_amount: float | int | Decimal, from_account: int, to Raises: ValueError: Transfer to the same account is forbidden. ValueError: The box transaction happened again in the same time. - ValueError: The log transaction happened again in the same time. + ValueError: The log transaction('xxx') happened again in the same time. ValueError: The created must be a str, was provided. """ @@ -831,7 +831,7 @@ def log(self, value: float, desc: str = '', account_id: int = 1, created: str = This method updates the account's balance, count, and log with the transaction details. Raises: - ValueError: The log transaction happened again in the same time. + ValueError: The log transaction('xxx') happened again in the same time. ValueError: The created must be a str, was provided. """ @@ -1972,7 +1972,7 @@ def log(self, value: float, desc: str = '', account_id: int = 1, created: str = if debug: print('create-log', created) if self.log_exists(account_id, created): - raise ValueError(f"The log transaction happened again in the same time({created}).") + raise ValueError(f"The log transaction('{desc}') happened again in the same time({created}).") if debug: print('created-log', created) self._vault['account'][account_id]['log'][created] = { @@ -3583,10 +3583,7 @@ def daily_logs(self, weekday: WeekDay = WeekDay.Friday, debug: bool = False): def export_json(self, path: str = "data.json") -> bool: with open(path, "w") as file: - vault = self.vault() - if self.debug: - print('vault', vault) - json.dump(vault, file, indent=4, cls=JSONEncoder) + json.dump(self.vault(), file, indent=4, cls=JSONEncoder) return True @pony.db_session() @@ -3683,7 +3680,7 @@ def _log(self, value: float, desc: str = '', account_id: int = 1, created: str = if debug: print('create-log', created) if self._log_exists(account_id, created): - raise ValueError(f"The log transaction happened again in the same time({created}).") + raise ValueError(f"The log transaction('{desc}') happened again in the same time({created}).") if debug: print('created-log', created) if self.raw_sql: