Enhance user feedback and improve exercise log retrieval - #37
Conversation
…tings and workout provider
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 47 minutes and 15 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR extracts exercise log lookup logic into a new Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@workout-logger/lib/services/storage_service.dart`:
- Around line 132-139: HistoryManager.getSessionsInDateRange currently assumes
start <= end and can return an empty list when dates are inverted; mirror the
normalization used in StorageService.getSessionsInDateRange by computing lo =
start.isAfter(end) ? end : start and hi = start.isAfter(end) ? start : end at
the top of HistoryManager.getSessionsInDateRange, then use lo/hi in the date
comparisons instead of start/end so inverted ranges are tolerated consistently
across both implementations.
In `@workout-logger/pubspec.yaml`:
- Line 23: The pubspec currently pins the Flutter SDK to an exact version via
the flutter key (flutter: 3.41.6); change this to a range constraint (for
example flutter: ">=3.41.6 <4.0.0" or flutter: ">=3.41.6") to allow dependency
resolution flexibility—edit the flutter entry in pubspec.yaml accordingly and
rely on CI/tooling to pin exact Flutter builds if reproducible builds are
required.
In `@workout-logger/test/exercise_history_test.dart`:
- Around line 27-87: Add a test that verifies/document the tie-break behavior
when two sessions share the same DateTime: create two sessions with identical
dates using helpers _session/_log/_set (e.g., weights 1 and 2), call
findMostRecentExerciseLog('bench', [a, b]) and assert the outcome you intend
(either a specific weight if you want a defined tie-break or simply expect
non-null and add a comment asserting ties are unspecified). If you prefer
undefined behavior, instead add a clear comment to the findMostRecentExerciseLog
implementation noting that when session.date values are equal the selection is
unspecified (List.sort is not stable), so callers/tests should not rely on a
deterministic tie-break.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: e2728e6f-0231-4218-88f4-c1f7cc00b9eb
📒 Files selected for processing (10)
workout-logger/lib/screens/profile_screen.dartworkout-logger/lib/screens/settings_screen.dartworkout-logger/lib/services/managers/analytics_manager.dartworkout-logger/lib/services/storage_service.dartworkout-logger/lib/services/utils/exercise_history.dartworkout-logger/lib/services/workout_provider.dartworkout-logger/pubspec.yamlworkout-logger/test/exercise_history_test.dartworkout-logger/test/test_utils/mock_storage_service.dartworkout-logger/test/workout_provider_test.dart
Improve user feedback mechanisms and streamline the retrieval of exercise logs in the settings and workout provider. Adjustments ensure that date ranges are handled correctly, and new utility functions simplify the process of finding the most recent exercise logs. Additionally, tests validate the functionality of these enhancements.
Summary by CodeRabbit
Release Notes
Bug Fixes
Refactor
Tests
Chores