feat: enhance exercise tracking with unilateral and double weight support#149
Conversation
…lags in user data
… weight for paired exercises in settings
… for paired exercises in exercise detail
…weights/reps for unilateral exercises
…ow and update fetchCompletedWorkoutById
… for paired exercises in WeeklySummaryCard
…paired weights across components
… CompletedWorkout interfaces
There was a problem hiding this comment.
Sorry @isotronic, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ 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: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR introduces two new per-exercise configuration flags— ChangesExercise Stats Doubling Flags and Volume Multipliers
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 2
🧹 Nitpick comments (2)
app/(app)/custom-exercise.tsx (1)
592-599: 💤 Low valueConsider using
Switchfromreact-native-paperfor visual consistency.The settings screen and other parts of the app use
Switchfromreact-native-paper, which has different default styling (and usescolorprop instead ofthumbColor). Using the same component would ensure consistent appearance across the app.♻️ Suggested change
The
Switchis already exported fromreact-native-paperin this file (line 13 imports fromreact-native-paper). Remove theSwitchfrom thereact-nativeimport and use the paper version:import { ScrollView, TextInput, Alert, StyleSheet, KeyboardAvoidingView, Platform, Image, View, - Switch, } from "react-native"; -import { Button, Divider } from "react-native-paper"; +import { Button, Divider, Switch } from "react-native-paper";Then update the Switch usage to use
colorinstead ofthumbColor:<Switch value={isUnilateral} onValueChange={(v: boolean) => { setIsUnilateral(v); markDirty(); }} - thumbColor={Colors.dark.tint} + color={Colors.dark.tint} />Also applies to: 611-618
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/`(app)/custom-exercise.tsx around lines 592 - 599, The current Switch usage imports the RN core Switch and passes thumbColor (Switch used with isUnilateral, setIsUnilateral, markDirty and Colors.dark.tint), but the file already exports Switch from react-native-paper; remove the Switch import from react-native and use the paper Switch instead, replacing the thumbColor prop with the paper prop name color (e.g., color={Colors.dark.tint}); update the other Switch instance(s) (the one around lines 611–618) likewise so all Switches in this component use react-native-paper's Switch for consistent styling.utils/database.ts (1)
226-229: ⚡ Quick winExtend
ExerciseCheckResultinterface instead of using type assertions.The
ExerciseCheckResultinterface (lines 120-129) is missingis_unilateralanddouble_weightfields, requiring unsafe type assertions here. Adding these fields to the interface ensures type safety.Suggested fix
Add to the
ExerciseCheckResultinterface around line 129:interface ExerciseCheckResult { app_exercise_id: number | null; name: string; image: Uint8Array | null; description: string | null; animated_url: string | null; equipment: string | null; tracking_type: string | null; is_deleted: number; + is_unilateral: number | null; + double_weight: number | null; }Then update the case statements:
case "is_unilateral": - return row[col] !== (existingEntry as any).is_unilateral; + return row[col] !== existingEntry.is_unilateral; case "double_weight": - return row[col] !== (existingEntry as any).double_weight; + return row[col] !== existingEntry.double_weight;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@utils/database.ts` around lines 226 - 229, The ExerciseCheckResult interface is missing the is_unilateral and double_weight properties, forcing unsafe casts in the comparison switch; add these fields to the ExerciseCheckResult interface (e.g., is_unilateral?: boolean; double_weight?: boolean;) so the case branches for "is_unilateral" and "double_weight" can use (existingEntry as ExerciseCheckResult).is_unilateral / .double_weight safely (and remove the any type assertions).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@constants/WhatsNew.ts`:
- Line 159: The release note entry for version 2619 in constants/WhatsNew.ts
contains a stray diff artefact ("159~" / backtick marker) that leaked into the
displayed text; locate the version 2619 message (the string/array element in
WhatsNew.ts that contains "2619") and remove the stray diff markers (`159~`,
stray backticks or punctuation) so the string contains only the intended release
text, then ensure the surrounding syntax (closing quotes/backticks and trailing
comma) remains valid.
- Line 166: Change the American spelling "Customize" to British English
"Customise" in the string "Customize how your volume and stats are calculated
with three new options in Settings:" so it reads "Customise how your volume and
stats are calculated with three new options in Settings:"; locate and update
this literal in the WhatsNew content (the string shown in the diff) to maintain
en-GB consistency.
---
Nitpick comments:
In `@app/`(app)/custom-exercise.tsx:
- Around line 592-599: The current Switch usage imports the RN core Switch and
passes thumbColor (Switch used with isUnilateral, setIsUnilateral, markDirty and
Colors.dark.tint), but the file already exports Switch from react-native-paper;
remove the Switch import from react-native and use the paper Switch instead,
replacing the thumbColor prop with the paper prop name color (e.g.,
color={Colors.dark.tint}); update the other Switch instance(s) (the one around
lines 611–618) likewise so all Switches in this component use
react-native-paper's Switch for consistent styling.
In `@utils/database.ts`:
- Around line 226-229: The ExerciseCheckResult interface is missing the
is_unilateral and double_weight properties, forcing unsafe casts in the
comparison switch; add these fields to the ExerciseCheckResult interface (e.g.,
is_unilateral?: boolean; double_weight?: boolean;) so the case branches for
"is_unilateral" and "double_weight" can use (existingEntry as
ExerciseCheckResult).is_unilateral / .double_weight safely (and remove the any
type assertions).
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ca112a2d-7f55-4b99-84ff-277a83268280
📒 Files selected for processing (16)
app/(app)/(tabs)/(stats)/exercise-detail.tsxapp/(app)/(tabs)/(stats)/index.tsxapp/(app)/(tabs)/index.tsxapp/(app)/(tabs)/settings.tsxapp/(app)/(workout)/workout-summary.tsxapp/(app)/custom-exercise.tsxapp/_layout.tsxcomponents/WeeklySummaryCard.tsxcomponents/charts/VolumeBarChart.tsxconstants/WhatsNew.tshooks/useCompletedWorkoutsQuery.tshooks/useExerciseDetailQuery.tshooks/useTrackedExercisesQuery.tsutils/database.tsutils/initAppDataDB.tsutils/initUserDataDB.ts
Summary by CodeRabbit
Release Notes