8000 import garmin data in date range by maksm · Pull Request #154 · joaovitoriasilva/endurain · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

import garmin data in date range #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

maksm
Copy link
Contributor
@maksm maksm commented May 12, 2025

This pull request introduces significant changes to the Garmin integration, transitioning from "days-based" to "date-range-based" functionality for activity and health data retrieval. It includes backend updates to support date ranges, frontend modifications for user input, and improved error handling and logging.

Backend Changes

Refactored Functions to Support Date Ranges:

  • fetch_and_process_activities_by_dates and fetch_and_process_bc_by_dates: Updated to accept start_date and end_date parameters instead of calculating based on days. These functions now fetch data within a specific date range, improving flexibility. [1] [2]
  • get_user_garminconnect_activities_by_dates and get_user_garminconnect_bc_by_dates: Replaced the previous "days-based" functions to handle date ranges. Added detailed logging for the date range being processed. [1] [2]

Enhanced Error Handling and Logging:

  • Improved exception handling in multiple functions to log errors more descriptively, including the date range being processed. [1] [2]

Frontend Changes

New Date Range Modal Component:

  • Added ModalComponentDateRangeInput.vue: A reusable modal for selecting start and end dates, with default values pre-set to the last 7 days. This component emits the selected date range for further processing.

Updated UI for Garmin Data Retrieval:

  • Modified dropdown menu in SettingsIntegrationsZone.vue to replace "days-based" options with "date-range-based" options for both activity and health data retrieval.

API Changes

  • Updated /activities and /health endpoints to accept start_date and end_date parameters instead of days. Adjusted background tasks to use the new date range methods. [1] [2]

@joaovitoriasilva joaovitoriasilva requested a review from Copilot May 20, 2025 15:35
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request refactors the Garmin integration to support date-range-based data retrieval by updating both backend endpoints and frontend UI components while also improving error logging.

  • The backend now uses start_date and end_date parameters instead of days to fetch activities and health data.
  • The frontend updates include new modal components as well as revised translation strings for date range selection.
  • API routes, service calls, and utility functions have been adjusted to handle the new date range parameters.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/app/src/services/garminConnectService.js Updated service methods for activities and health data to use date range parameters.
frontend/app/src/i18n/* Updated labels and modal titles in multiple languages to reflect date range usage.
frontend/app/src/components/Settings/SettingsIntegrationsZone.vue Modified modal calls and component imports to use date range modals.
frontend/app/src/components/Modals/ModalComponentDateRangeInput.vue New modal component for date range input.
backend/app/garmin/router.py Updated endpoints and parameter processing to use date range values.
backend/app/garmin/health_utils.py & activity_utils.py Refactored functions to process data using start_date and end_date parameters.

@joaovitoriasilva joaovitoriasilva self-assigned this May 20, 2025
@joaovitoriasilva joaovitoriasilva added the enhancement New feature or request lab 8000 el May 20, 2025
@joaovitoriasilva joaovitoriasilva moved this from Todo to In Progress in Endurain project May 20, 2025
@joaovitoriasilva joaovitoriasilva added this to the v0.11.X milestone May 20, 2025
@joaovitoriasilva
Copy link
Owner

Hello. This is merged on pre-release.
I re added the option for the user to still get activities and health data using days.

I'll ask you next time to not remove functionality, or at least ask before removing to ensure consistency. :)

@maksm
Copy link
Contributor Author
maksm commented May 22, 2025

Hey sorry for the removal, will be more careful next time 🙇‍♂️

@joaovitoriasilva
Copy link
Owner

No worries. Thanks again for the help :)

@joaovitoriasilva joaovitoriasilva merged commit 33e7a3d into joaovitoriasilva:master May 22, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Endurain project May 22, 2025
@maksm maksm deleted the garmin-import-datefromto branch May 23, 2025 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants
0