Skip to content

Fix protein requirements to match endurance hiking guidelines#50

Merged
grepsedawk merged 1 commit into
mainfrom
feature/protein-progress-bar
Aug 11, 2025
Merged

Fix protein requirements to match endurance hiking guidelines#50
grepsedawk merged 1 commit into
mainfrom
feature/protein-progress-bar

Conversation

@grepsedawk

Copy link
Copy Markdown
Owner

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

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]>
Copilot AI review requested due to automatic review settings August 11, 2025 03:44
@grepsedawk
grepsedawk merged commit 6396217 into main Aug 11, 2025
1 check passed
@grepsedawk
grepsedawk deleted the feature/protein-progress-bar branch August 11, 2025 03:44

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 goalProtein method in pages/food/ShowTotals.js has 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

  1. 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.

@github-actions

Copy link
Copy Markdown

🚀 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.

github-actions Bot pushed a commit that referenced this pull request Aug 11, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread pages/food/ShowTotals.js
Comment on lines +161 to +163
// 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

Copilot AI Aug 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested 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

Copilot uses AI. Check for mistakes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pages/food/ShowTotals.js
Comment on lines +161 to +163
// 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested 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
const PROTEIN_CALORIE_RATIO = 0.125;
const CALORIES_PER_GRAM_PROTEIN = 4;
return (this.goalCalories() * PROTEIN_CALORIE_RATIO) / CALORIES_PER_GRAM_PROTEIN;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants