Skip to content

fix for oauth and /health-data to handle exercise sets.#674

Merged
CodeWithCJ merged 3 commits intomainfrom
dev
Feb 16, 2026
Merged

fix for oauth and /health-data to handle exercise sets.#674
CodeWithCJ merged 3 commits intomainfrom
dev

Conversation

@CodeWithCJ
Copy link
Owner

fix for oauth and /health-data exercise set from mobile.

#673

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @CodeWithCJ, 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!

This pull request addresses a fix for OAuth authentication argument handling and significantly enhances the /health-data endpoint's capability to process exercise sets from mobile applications. The changes streamline the initiateOidcLogin function's parameter passing and ensure that detailed exercise data, including sets, is correctly captured and stored. Additionally, the update includes general code cleanup and more robust error reporting within the health data processing logic.

Highlights

  • OAuth Argument Refactoring: Refactored initiateOidcLogin calls in the authentication page to use an object-based argument structure, enhancing clarity and maintainability.
  • Exercise Set Handling in Health Data: Implemented support for processing and storing exercise sets within the /health-data endpoint, specifically for exercise sessions originating from mobile devices.
  • Code Consistency and Error Handling: Standardized string literal usage to double quotes and improved error handling and logging across the measurementService.js file for better code consistency and debugging.
Changelog
  • SparkyFitnessFrontend/src/pages/Auth/Auth.tsx
    • Updated initiateOidcLogin calls to accept an object containing providerId and requestSignUp.
  • SparkyFitnessServer/services/measurementService.js
    • Standardized string literals from single to double quotes for consistency.
    • Reformatted object and array literals for improved readability.
    • Modified processHealthData and processMobileHealthData to pass sets data when creating exercise entries for ExerciseSession and Workout types.
    • Enhanced error messages and logging calls for better clarity and debugging.
    • Adjusted parameter passing for various helper functions to ensure consistent use of actingUserId and source.
    • Refined the calculateSleepScore function with minor logical and formatting adjustments.
    • Ensured timeAsleepInSeconds is correctly calculated in processSleepEntry and updateSleepEntry by filtering out 'awake' stage events.
Activity
  • CodeWithCJ opened this pull request to address issues related to OAuth and health data processing for exercise sets.
  • The initial commit included changes to refactor OAuth login arguments and enhance health data handling.
  • The pull request description links to issue [Bug]: OIDC Button Not Working #673, indicating a specific problem being resolved.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

Copy link
Contributor

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

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 refactors OAuth calls to use an object for parameters, which improves readability, and adds functionality to handle exercise sets from mobile health data. While the exercise set handling is implemented in processHealthData, it seems to have been missed in the processMobileHealthData function, which is a key area for this feature. The other changes are primarily stylistic and improve code formatting.

Comment on lines 731 to 739
{
exercise_id: exercise.id,
duration_minutes: duration ? duration / 60 : 0,
calories_burned: caloriesBurned,
entry_date: parsedDate,
notes: `Source: ${source}, Activity Type: ${activityType}`,
distance: distance,
// Add other exercise-related fields from mobileHealthData if available
},
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The processMobileHealthData function handles ExerciseSession and Workout types, but it doesn't pass the sets data to createExerciseEntry. This is inconsistent with the changes in processHealthData and the goal of this PR to handle exercise sets from mobile. Please add the sets property to the object passed to createExerciseEntry to ensure exercise sets from mobile are processed correctly.

Suggested change
{
exercise_id: exercise.id,
duration_minutes: duration ? duration / 60 : 0,
calories_burned: caloriesBurned,
entry_date: parsedDate,
notes: `Source: ${source}, Activity Type: ${activityType}`,
distance: distance,
// Add other exercise-related fields from mobileHealthData if available
},
{
exercise_id: exercise.id,
duration_minutes: duration ? duration / 60 : 0,
calories_burned: caloriesBurned,
entry_date: parsedDate,
notes: `Source: ${source}, Activity Type: ${activityType}`,
distance: distance,
sets: dataEntry.sets || null,
// Add other exercise-related fields from mobileHealthData if available
},

Copy link
Owner Author

Choose a reason for hiding this comment

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

done

@CodeWithCJ CodeWithCJ merged commit 8139512 into main Feb 16, 2026
6 checks passed
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.

1 participant