Closed jschalk closed 1 month ago
This pull request implements significant changes to the fiscal and transaction management system. It adds new functionality to the FiscalUnit class, introduces error handling for various operations, and improves the overall structure of the codebase. The changes focus on enhancing the management of cash purchases, purview episodes, and transaction books.
classDiagram
class FiscalUnit {
+set_cashpurchase(TranUnit)
+cashpurchase_exists(AcctID, AcctID, TimeLinePoint) bool
+get_cashpurchase(AcctID, AcctID, TimeLinePoint) TranUnit
+del_cashpurchase(AcctID, AcctID, TimeLinePoint)
+set_current_time(TimeLinePoint)
+set_all_tranbook()
+add_purviewepisode(OwnerID, TimeLinePoint, int)
+get_purviewlogs_timestamps() set[TimeLinePoint]
-_all_tranbook: TranBook
}
class TranBook {
+set_tranunit(TranUnit, set[TimeLinePoint], TimeLinePoint)
+add_tranunit(OwnerID, AcctID, TimeLinePoint, FundNum, set[TimeLinePoint], TimeLinePoint)
+tranunit_exists(AcctID, AcctID, TimeLinePoint) bool
+get_tranunit(AcctID, AcctID, TimeLinePoint) TranUnit
+del_tranunit(AcctID, AcctID, TimeLinePoint)
+get_timestamps() set[TimeLinePoint]
+join(TranBook)
-fiscal_id: FiscalID
-tranunits: dict[OwnerID, dict[AcctID, dict[TimeLinePoint, FundNum]]]
-_accts_net: dict[OwnerID, dict[AcctID, FundNum]]
}
class TranUnit {
+src: AcctID
+dst: AcctID
+timestamp: TimeLinePoint
+amount: FundNum
}
FiscalUnit --> TranBook
TranBook --> TranUnit
Change | Details | Files |
---|---|---|
Enhanced FiscalUnit class with new methods for managing cash purchases and current time |
|
src/f7_fiscal/fiscal.py |
Improved error handling and validation in FiscalUnit operations |
|
src/f7_fiscal/fiscal.py src/f7_fiscal/test_fiscal_/test_fiscal_bud_purview.py |
Refactored and enhanced TranBook class functionality |
|
src/f1_road/finance_tran.py src/f1_road/test/test_z_finance_tran_core.py src/f1_road/test/test_z_finance_tran_join.py |
Updated test cases to reflect new functionality and error handling |
|
src/f7_fiscal/test_fiscal_/test_fiscal_bud_purview.py src/f7_fiscal/test_fiscal_/test_fiscal_cash_purchase.py src/f7_fiscal/test_fiscal_/test_fiscal_json.py |
Summary by Sourcery
Enhance the fiscal management system by introducing new classes for transaction handling and refactoring existing classes for better error management and functionality. Add extensive tests to ensure the robustness of the new and updated features.
New Features:
TranUnit
andTranBook
classes to manage transaction units and books, providing methods for adding, deleting, and checking transactions.FiscalUnit
class, including methods to add, delete, and verify purview episodes.Enhancements:
FiscalUnit
class to use_all_tranbook
instead of_tranbook
for managing all transaction books.FiscalUnit
class by introducing custom exceptions for specific error scenarios related to cash purchases and current time settings.Tests:
TranUnit
andTranBook
classes, covering scenarios such as adding, deleting, and joining transaction units.FiscalUnit
class to verify the correct handling of purview episodes and cash purchases, including edge cases and error conditions.