Skip to content
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

[Health 6.0.0] Incorrect dataType for Swimming activity pulled from Google Fit #1063

Open
agilst opened this issue Oct 24, 2024 · 1 comment
Assignees
Labels
awaiting feedback Waiting for the user to respond to the latest comment bugfix a bug fix

Comments

@agilst
Copy link

agilst commented Oct 24, 2024

Remember to specify the plugin name in the title!

Device / Emulator and OS

Please complete the following information for each phone and/or emulator you're experiencing this bug on:

  • Device: Samsung Galaxy S10
  • OS: Android Latest

Description

Swimming activity on Google Fit always pulled as double activities with the same value, the first one as DISTANCE_DELTA and the other one is WORKOUT - OTHER.

// First activity
I/flutter (29481):     HealthActivity - 
I/flutter (29481):     value: 800.0,
I/flutter (29481):     unit: METER,
I/flutter (29481):     dateFrom: 2024-10-24 09:18:00.000,
I/flutter (29481):     dateTo: 2024-10-24 09:48:00.001,
I/flutter (29481):     dataType: DISTANCE_DELTA,
I/flutter (29481):     platform: PlatformType.ANDROID,
I/flutter (29481):     deviceId: SP1A.210812.016,
I/flutter (29481):     sourceId: ,
I/flutter (29481):     sourceName: com.google.android.apps.fitness

// Second activity
I/flutter (29481):     HealthActivity - 
I/flutter (29481):     value: workoutActivityType: OTHER,
I/flutter (29481):            totalEnergyBurned: 249,
I/flutter (29481):            totalEnergyBurnedUnit: KILOCALORIE,
I/flutter (29481):            totalDistance: 800,
I/flutter (29481):            totalDistanceUnit: METER,
I/flutter (29481):     unit: NO_UNIT,
I/flutter (29481):     dateFrom: 2024-10-24 09:18:00.000,
I/flutter (29481):     dateTo: 2024-10-24 09:48:00.000,
I/flutter (29481):     dataType: WORKOUT,
I/flutter (29481):     platform: PlatformType.ANDROID,
I/flutter (29481):     deviceId: SP1A.210812.016,
I/flutter (29481):     sourceId: ,
I/flutter (29481):     sourceName: com.google.android.apps.fitness

On top of that, the dateTo has .001 millisecond different. can it be fetched as single data with a correct dataType?

To Reproduce

Fetch data as usual

List<HealthActivity> healthPoints =
    (await health.getHealthDataFromTypes(
  now.subtract(Duration(days: 30)),
  now,
  HealthRecord.recordClassTypes,
))
        .map((e) => e.activity)
        .toList();

healthPoints.removeWhere((e) => e.distance < 0.1);
healthPoints.sort((a, b) => b.dateTo.compareTo(a.dateTo));
print('${healthPoints}');

Expected behavior

Doubled data should be pulled as single data with a correct dataType

Screenshots

unnamed-2

@agilst agilst added the bugfix a bug fix label Oct 24, 2024
@iarata iarata self-assigned this Oct 30, 2024
@iarata
Copy link

iarata commented Oct 30, 2024

Could you confirm if you are using the health version 6 and not the latest? is it possible to test with the latest release? However, I can't see why this is a problem. The health package is designed to handle different types of health data which includes distance and workout activities which are two separate things.

The date format is correct and we are using ISO 8601 date format which you can easily convert to other types if you need to.

@iarata iarata added the awaiting feedback Waiting for the user to respond to the latest comment label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Waiting for the user to respond to the latest comment bugfix a bug fix
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants