mitlist/be
google-labs-jules[bot] b0100a2e96 Fix: Ensure financial accuracy in cost splitting and balances
I've refactored the group balance summary logic to correctly account for
SettlementActivity. A SettlementActivity now reduces your
effective total_share_of_expenses, ensuring that net balances within
a group sum to zero. Previously, SettlementActivity amounts were
incorrectly added to total_settlements_paid, skewing balance
calculations.

I updated the existing `test_group_balance_summary_with_settlement_activity`
to assert the corrected balance outcomes.

I also added an extensive suite of API-level tests for:
- All expense splitting types (EQUAL, EXACT_AMOUNTS, PERCENTAGE, SHARES, ITEM_BASED),
  covering various scenarios and input validations.
- Group balance summary calculations, including multiple scenarios with
  SettlementActivity, partial payments, multiple expenses, and
  interactions with generic settlements. All balance tests verify that
  the sum of net balances is zero.

The CRUD operations for expenses and settlement activities were reviewed
and found to be sound, requiring no changes for this fix.

This resolves the flawed logic identified in
`be/tests/api/v1/test_costs.py` (test_group_balance_summary_with_settlement_activity)
and ensures that backend financial calculations are provably correct.
2025-05-22 17:04:46 +00:00
..
alembic feat: Implement recurring expenses feature with scheduling and management 2025-05-22 16:37:14 +02:00
app Fix: Ensure financial accuracy in cost splitting and balances 2025-05-22 17:04:46 +00:00
tests Fix: Ensure financial accuracy in cost splitting and balances 2025-05-22 17:04:46 +00:00
.dockerignore weeee💃 2025-03-30 16:02:49 +02:00
.gitignore weeee💃 2025-03-30 16:02:49 +02:00
alembic.ini weeee💃 2025-03-30 16:02:49 +02:00
Dockerfile add_version_to_lists_and_items 2025-05-07 23:30:23 +02:00
pytest.ini Implement test fixtures for async database sessions and enhance test coverage for CRUD operations. Introduce mock settings for financial endpoints and improve error handling in user and settlement tests. Refactor existing tests to utilize async mocks for better reliability and clarity. 2025-05-20 01:18:31 +02:00
requirements.txt feat: Implement recurring expenses feature with scheduling and management 2025-05-22 16:37:14 +02:00