Fix protein requirements to match endurance hiking guidelines#50
Conversation
Updated protein goal from 18% to 12.5% of calories (middle of recommended 10-15% range). Research shows endurance hikers need 1-1.6g/kg body weight or 10-15% of total calories from protein, not 18%. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Summary of Changes
Hello @grepsedawk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
I've updated the protein goal calculation within the food tracking system. This change specifically adjusts the target percentage of calories derived from protein to better align with recommended guidelines for endurance hiking, moving from an 18% target to 12.5%. This ensures the system provides more accurate nutritional guidance for users engaged in such activities.
Highlights
- Protein Goal Adjustment: The
goalProteinmethod inpages/food/ShowTotals.jshas been updated to reflect new endurance hiking guidelines. The protein target percentage has been changed from 18% to 12.5% of total calories.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
|
🚀 PR Preview deployed! You can preview this PR at: https://grepsedawk.github.io/planmy.hike/pr-50/ The preview will update automatically when you push new commits to this PR. This comment was automatically generated by the PR Preview workflow. |
There was a problem hiding this comment.
Pull Request Overview
This PR updates the protein calculation for endurance hiking nutrition from 18% to 12.5% of total calories to align with research-based guidelines for endurance activities.
- Reduced protein percentage from 18% to 12.5% of total calories
- Updated comment to reflect the 10-15% range for endurance activities and explain the middle value selection
| // 12.5% of calories from protein (middle of 10-15% range for endurance activities) | ||
| // 4 calories per gram of protein | ||
| return (this.goalCalories() * 0.125) / 4 |
There was a problem hiding this comment.
The magic number 0.125 should be extracted to a named constant like PROTEIN_PERCENTAGE = 0.125 to improve code maintainability and make it easier to adjust if guidelines change.
| // 12.5% of calories from protein (middle of 10-15% range for endurance activities) | |
| // 4 calories per gram of protein | |
| return (this.goalCalories() * 0.125) / 4 | |
| // 4 calories per gram of protein | |
| return (this.goalCalories() * PROTEIN_PERCENTAGE) / 4 |
There was a problem hiding this comment.
Code Review
This pull request correctly updates the protein requirement calculation to align with endurance hiking guidelines. My feedback focuses on improving code maintainability by replacing magic numbers with named constants, which will make the calculation more self-documenting and easier to modify in the future.
| // 12.5% of calories from protein (middle of 10-15% range for endurance activities) | ||
| // 4 calories per gram of protein | ||
| return (this.goalCalories() * 0.125) / 4 |
There was a problem hiding this comment.
The updated value is correct, but using magic numbers like 0.125 and 4 directly makes the code less readable and harder to maintain.
To improve clarity, please extract these values into named constants. This makes the formula's intent self-documenting.
| // 12.5% of calories from protein (middle of 10-15% range for endurance activities) | |
| // 4 calories per gram of protein | |
| return (this.goalCalories() * 0.125) / 4 | |
| const PROTEIN_CALORIE_RATIO = 0.125; | |
| const CALORIES_PER_GRAM_PROTEIN = 4; | |
| return (this.goalCalories() * PROTEIN_CALORIE_RATIO) / CALORIES_PER_GRAM_PROTEIN; |
Updated protein goal from 18% to 12.5% of calories (middle of recommended 10-15% range). Research shows endurance hikers need 1-1.6g/kg body weight or 10-15% of total calories from protein, not 18%.
🤖 Generated with Claude Code