Skip to content

Conversation

@Jozys
Copy link
Collaborator

@Jozys Jozys commented Apr 10, 2025

MoveTopia Update Changelog

New functions

Bug fixes

  • Fixed incorrect display of the current days steps
  • Fixed incorrect display of total steps in badges

Neue Funktionen

Fehlerbehebungen

  • Korrektur der fehlerhaften Anzeige von Schritten des aktuellen Tages
  • Korrektur der fehlerhaften Gesamtschrittzahl in den Badges.

Jozys added 3 commits April 9, 2025 10:10
# 🚀 Pull Request

## Brief Description
This pull request fixes problems with inconsistent dates coming from
Health Connect. It tries to parse all needed dates to utc, to ensure a
consistent date handling. In addition to that it also fixes a missing
iteration for the step calculation in the total step badges.

## Linked Issues
Fixes #101

## GitHub Copilot Text
This pull request includes multiple changes aimed at ensuring proper
handling of time zones and improving the robustness of the step counting
logic. The most important changes include converting date and time
values to UTC, updating step counting logic to handle empty lists, and
adding utility functions for time zone conversions.

### Time Zone Handling Improvements:
*
[`lib/data/repositories/base_local_health_impl.dart`](diffhunk://#diff-d65e3fe018d4f55ec02d268560a3058f224079bd55bcebd461a01bbc171e4abbR35-R41):
Added checks to convert `dateFrom` and `dateTo` fields to UTC if they
are not already in UTC.
*
[`lib/data/service/health_service_impl.dart`](diffhunk://#diff-3e53fc5b1dfa9fdd52f251a640e34d6e0d9885b33745f4471df5785f1d0dabe0R12):
Adjusted the start and end times to UTC before processing health data.
Removed redundant UTC conversion for cached data.
[[1]](diffhunk://#diff-3e53fc5b1dfa9fdd52f251a640e34d6e0d9885b33745f4471df5785f1d0dabe0R12)
[[2]](diffhunk://#diff-3e53fc5b1dfa9fdd52f251a640e34d6e0d9885b33745f4471df5785f1d0dabe0R61-R63)
[[3]](diffhunk://#diff-3e53fc5b1dfa9fdd52f251a640e34d6e0d9885b33745f4471df5785f1d0dabe0L78-R82)
*
[`lib/utils/system_utils.dart`](diffhunk://#diff-fa53e970602244b2a9aef530e233a7a1e27b1d588854f4dcd1a4675529455f26R21-R29):
Added `toUtc` and `toLocal` utility functions to handle conversion
between UTC and local time.

### Step Counting Logic Improvements:
*
[`lib/domain/service/badge_service.dart`](diffhunk://#diff-239931c5e4b5972271d0be0392134797664b059227ddf308ecfa3569d4a6a89cL79-R89):
Updated the step counting logic to iterate through the list of steps and
sum them up, handling cases where the list might be empty.
*
[`lib/presentation/challenges/provider/badge_lists_provider.dart`](diffhunk://#diff-3148057caf03ce3008b4ce4297da3575e7af5ea6345eccde97f2092a426bb633L24-R46):
Modified the logic to calculate total steps by iterating through the
list of steps and summing them up, ensuring the list is not empty before
processing.

### Presentation Layer Updates:
*
[`lib/presentation/activities/details/widget/header_details.dart`](diffhunk://#diff-af1ca86a8360c252650e800688ce9db2018affd75d26e1c92a476aa2245d0628R4):
Converted date and time values to local time for display purposes.
[[1]](diffhunk://#diff-af1ca86a8360c252650e800688ce9db2018affd75d26e1c92a476aa2245d0628R4)
[[2]](diffhunk://#diff-af1ca86a8360c252650e800688ce9db2018affd75d26e1c92a476aa2245d0628L43-R44)
*
[`lib/presentation/activities/list/screen/activities_screen.dart`](diffhunk://#diff-88f7691689bff6b9ae5559a39398280e2b845d3fe6c13d6a14e5387fb374e83cR13):
Updated the display of activity start and end times to use local time.
[[1]](diffhunk://#diff-88f7691689bff6b9ae5559a39398280e2b845d3fe6c13d6a14e5387fb374e83cR13)
[[2]](diffhunk://#diff-88f7691689bff6b9ae5559a39398280e2b845d3fe6c13d6a14e5387fb374e83cL200-R201)
@Jozys Jozys requested a review from ScreepCode April 10, 2025 14:42
@Jozys Jozys self-assigned this Apr 10, 2025
@ScreepCode ScreepCode merged commit c7fc3dd into main Apr 10, 2025
3 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.

3 participants