- Implement SynchronousExecutor for same-thread execution
- Prevents SQLite database locking in Django test transactions
- Normalize all Decimal outputs to 2 decimal places using quantize()
- Update test expectations for consistent decimal formatting
- Fix average_cost_per_day calculation to use quantized decimals
SQLite database locking prevented ThreadPoolExecutor from working with
Django test transactions which require same-thread database access.
Remove -n auto from test configuration to prevent database locking
errors with SQLite. SQLite does not support concurrent writes, causing
test failures when running tests in parallel.
Tests now run serially, which is compatible with SQLite file-based
database used in both local development and HuggingFace deployment.
feat: implement repository layer and cost-overview endpoint
Add DailyProgressRepository with aggregation methods for efficient data
access layer. Implement cost-overview endpoint that returns profile cost
summary and daily breakdown for a date range.
Repository Features:
- get_by_date: Query progress for profile on specific date with select_related
- get_aggregates_by_profile: Aggregate totals, averages, and counts for date range
- Explicit None handling with ternary operators (no implicit defaults)
Endpoint Features:
- Date range validation with proper YYYY-MM-DD format checking
- Summary statistics: total days, total feet/ice/cost, averages
- Daily breakdown showing only days with actual progress
- Uses repository layer for clean separation of concerns
Tests:
- 7 unit tests for repository methods (filtering, aggregation, edge cases)
- 6 integration tests for cost-overview endpoint (success, validation, errors)
All code passes ruff and mypy with zero violations.
feat: add DailyProgress API with auto-calculation
- Add DailyProgressSerializer with auto-calculation of ice_cubic_yards and cost_gold_dragons
- IceUsageCalculator service invoked during serializer create()
- DailyProgressViewSet with filtering on wall_section and date
- Comprehensive unit tests for serializer (6 tests)
- All 43 tests passing with 100% coverage
feat: add DailyProgress model and IceUsageCalculator service
Implemented TDD approach with full type safety:
- DailyProgress model with wall_section FK, date, feet_built, ice_cubic_yards, cost_gold_dragons
- Unique constraint on (wall_section, date)
- Database migration with indexes on date and (wall_section, date)
- IceUsageCalculator service for ice usage and cost calculations
- Constants: ICE_PER_FOOT=195 yd³/ft, COST_PER_CUBIC_YARD=1900 GD/yd³
- Unit tests for model (3 tests) and calculator (6 tests)
- 37 tests passing, 100% coverage, 0 mypy errors