jschalk / jaar

Cross-cultural communication engine built on customizable economic systems. Produces personalized agendas, calendars, finance reports for users.
0 stars 1 forks source link

175 enable documentation process #345

Closed jschalk closed 1 month ago

jschalk commented 1 month ago

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:

Enhancements:

Tests:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

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.

Class diagram for updated FiscalUnit and TranBook classes

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

File-Level Changes

Change Details Files
Enhanced FiscalUnit class with new methods for managing cash purchases and current time
  • Added set_cashpurchase method to handle cash purchase transactions
  • Implemented cashpurchase_exists, get_cashpurchase, and del_cashpurchase methods
  • Added set_current_time method with error handling for invalid time updates
  • Introduced set_all_tranbook method to combine cash purchases and purview episodes
src/f7_fiscal/fiscal.py
Improved error handling and validation in FiscalUnit operations
  • Added checks for timestamp validity in add_purviewepisode method
  • Implemented error handling for setting cash purchases with invalid timestamps
  • Added validation for setting current time to prevent conflicts with existing transactions
src/f7_fiscal/fiscal.py
src/f7_fiscal/test_fiscal_/test_fiscal_bud_purview.py
Refactored and enhanced TranBook class functionality
  • Added get_timestamps method to retrieve all transaction timestamps
  • Implemented join method to combine two TranBook instances
  • Updated del_tranunit method to correctly remove transactions
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
  • Added tests for new FiscalUnit methods like set_cashpurchase and set_current_time
  • Implemented tests for error cases in add_purviewepisode and set_current_time
  • Updated existing tests to use new method names and functionality
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

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).