Files
Sportstime/docs/BUG_FIX_PLAN.md
Trey t d034ee8612 fix: multiple bug fixes and improvements
- Fix suggested trips showing wrong sports for cross-country trips
- Remove quick start sections from home variants (Classic, Spotify)
- Remove dead quickActions code from HomeView
- Fix pace capsule animation in TripCreationView
- Add text wrapping to achievement descriptions
- Improve poll parsing with better error handling
- Various sharing system improvements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 09:35:18 -06:00

135 lines
5.9 KiB
Markdown

# Bug Fix Plan
**Created:** 2026-01-14
**Approach:** Batch by feature area, regression tests for each fix
**Total Bugs:** 12
---
## Batch 1: Sharing & Achievements (4 bugs)
**Files to modify:**
- `SportsTime/Export/Sharing/AchievementCardGenerator.swift`
- `SportsTime/Features/Progress/Views/AchievementsListView.swift`
- `SportsTime/Export/Sharing/ShareService.swift`
| Bug | Description | Root Cause Hypothesis | Fix Approach |
|-----|-------------|----------------------|--------------|
| **1.1** | Achievement text not wrapping, being cut off | Missing `.lineLimit(nil)` or fixed frame width | Add proper text wrapping constraints to `AchievementCard` |
| **1.2** | Remove username on share | Username hardcoded in share card render | Remove username field from `AchievementCardGenerator` output |
| **1.3** | "More" button on share doesn't do anything | Button has no action handler | Implement or remove the "More" button |
| **1.4** | Achievements share says "2,026" instead of "2026" | Number formatting with thousands separator | Fix year formatting to not use locale grouping |
**Tests to add:**
- `test_AchievementCard_TextWrapsCorrectly_LongAchievementNames`
- `test_ShareCard_DoesNotIncludeUsername`
- `test_YearFormatting_NoThousandsSeparator`
---
## Batch 2: Polls (4 bugs)
**Files to modify:**
- `SportsTime/Features/Polls/ViewModels/PollDetailViewModel.swift`
- `SportsTime/Features/Polls/Views/PollsListView.swift`
- `SportsTime/Core/Services/PollService.swift`
| Bug | Description | Root Cause Hypothesis | Fix Approach |
|-----|-------------|----------------------|--------------|
| **2.1** | Poll not found when tapping created poll | Share code case mismatch or CloudKit sync delay | Verify case handling; add local cache lookup before CloudKit |
| **2.2** | Poll refreshes every time screen appears | Missing cache, always fetching from CloudKit | Add local state caching, only fetch on pull-to-refresh |
| **2.3** | Creator cannot delete their poll | Deletion permission check failing or UI missing | Verify `notPollOwner` check; add delete button for owner |
| **2.4** | Trip details not showing in poll | Poll options not loading trip data | Check if trip reference is being dereferenced correctly |
**Tests to add:**
- `test_Poll_FoundByShareCode_CaseInsensitive`
- `test_PollsList_UsesLocalCache_NotRefreshOnAppear`
- `test_PollOwner_CanDeleteOwnPoll`
- `test_Poll_ShowsTripDetails_WhenLinked`
---
## Batch 3: Schedule & Games (3 bugs)
**Files to modify:**
- `SportsTime/Features/Schedule/Views/ScheduleListView.swift`
- `SportsTime/Features/Schedule/ViewModels/ScheduleViewModel.swift`
- `SportsTime/Features/Home/Views/Variants/Classic/HomeContent_Classic.swift`
- Possibly: Data layer if timezone issue
| Bug | Description | Root Cause Hypothesis | Fix Approach |
|-----|-------------|----------------------|--------------|
| **3.1** | Games showing at 7 AM (incorrect time) | Timezone conversion issue (UTC displayed as local) | Investigate game time storage; fix timezone handling |
| **3.2** | Today's games not highlighted | `isToday` cache not reactive or comparison bug | Check date comparison logic; ensure proper calendar usage |
| **3.3** | Featured trip shows NBA+NHL but only has NHL game | Filter logic bug in `SuggestedTripsGenerator` | Fix sport filtering when generating featured trips |
**Tests to add:**
- `test_GameTime_DisplaysInLocalTimezone`
- `test_ScheduleList_HighlightsTodaysGames`
- `test_FeaturedTrip_OnlyShowsSportsWithGames`
---
## Batch 4: Home Screen (1 bug)
**Files to modify:**
- `SportsTime/Features/Home/Views/Variants/Classic/HomeContent_Classic.swift`
- Possibly all 18+ design variants in `Features/Home/Views/Variants/`
| Bug | Description | Root Cause Hypothesis | Fix Approach |
|-----|-------------|----------------------|--------------|
| **4.1** | Remove Home Screen quick start | Feature no longer wanted | Remove `quickActions` section from all home variants |
**Tests to add:**
- `test_HomeScreen_NoQuickStartSection`
**Note:** Need to check all 18+ design variants. May need to grep for `quickActions` or `SportSelectorGrid` across all variant files.
---
## Batch 5: Trips View (1 bug)
**Files to modify:**
- `SportsTime/Features/Trip/Views/TripCreationView.swift` (or wherever pace selector lives)
- Possibly: A filter view in trips list
| Bug | Description | Root Cause Hypothesis | Fix Approach |
|-----|-------------|----------------------|--------------|
| **5.1** | Pace capsule animation looks off when selecting packed/moderate/relaxed | Animation timing or layout issue with selection state | Investigate capsule animation; fix transition |
**Note from exploration:** The pace selector UI may be in a trips filtering view (line 1521 shows `TripPaceFilter`), not trip creation. Need to locate the exact view with the animation bug.
**Tests to add:**
- UI test: `test_PaceSelector_AnimatesSmoothlOnSelection`
---
## Execution Order
1. **Batch 1 (Sharing)** - Most visible to users, affects social features
2. **Batch 2 (Polls)** - Existing functionality broke, needs regression fix
3. **Batch 3 (Schedule)** - Core app functionality
4. **Batch 4 (Home)** - Simple removal
5. **Batch 5 (Trips)** - Minor UI polish
---
## Investigation Needed Before Fixes
| Item | Question | How to Investigate |
|------|----------|-------------------|
| 7 AM games | Is this timezone or bad data? | Check a specific game's stored `dateTime` vs expected local time |
| Poll not found | Is it case sensitivity or sync timing? | Test with uppercase/lowercase share codes; check CloudKit logs |
| More button | What should it do, or should it be removed? | Ask user for intended behavior |
| Quick start | Remove from all 18 variants or just Classic? | Confirm scope with user |
---
## Decisions Made
| Question | Decision |
|----------|----------|
| "More" button on share | **Remove it** - button serves no purpose |
| Quick start removal | **All 18+ variants** - for consistency |
| Poll trip details | **Full summary** - cities, games, dates, duration |