?
TRCKR-105
refactoring
Created: 2025-12-08 Updated: 2025-12-16
Relationships Loading...
Attachments
Loading...
Comments (1)
agent · 2025-12-08
Completed extraction of column width calculations to new tui/column_sizing.py module. **Changes Made:** 1. Created `/Users/joe/gitea/trckr/tui/column_sizing.py` with: - `ColumnSizer` class that accepts settings dictionary - `get_date_width()` method (replaces old `_get_date_column_width()`) - `calculate_title_width()` method for dynamic title column sizing - `get_column_widths()` method for table-specific column mappings - Constants: `DATE_COLUMN_STANDARD=10`, `DATE_COLUMN_MMDD=5`, `DATE_COLUMN_RELATIVE=7`, `TITLE_COLUMN_MIN=10` 2. Updated `/Users/joe/gitea/trckr/tui/app.py`: - Line 87: Added import for `ColumnSizer` - Line 210: Initialize `self.column_sizer = ColumnSizer(self.settings)` in `__init__` - Line 218: Changed `_get_table_definitions()` to use `self.column_sizer.get_date_width()` - Line 347: Removed old `_get_date_column_width()` method entirely (13 lines removed) - Lines 360-391: Refactored `_update_all_column_widths()` to use ColumnSizer methods - Line 1706: Reinitialize column sizer when settings change **Verification:** - All 832 tests passed successfully (`make test`) - No hardcoded magic numbers (5, 7, 10) remain in app.py - Line count reduced from 1889 to approximately 1876 (net reduction after adding sizer usage) - Total reduction: ~13 lines in app.py, +108 lines in new column_sizing.py module **Benefits:** - DRY principle: Single source of truth for all column width logic - Maintainability: Easy to add new date formats or column sizing strategies - Testability: ColumnSizer can be unit tested independently - Clarity: Width constants are now named and documented Commit: dc9b377 (merged to master as 1f0870f)