mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Fix workout sync to track end time instead of start time for last synced position
Changed getLastSampleTimestamp() for WORKOUTS to use workout EndTime instead of StartTime. Previously, using StartTime caused the sync state to advance only to the start of the last workout, resulting in that workout being re-synced on every sync run and any new workouts started after it being missed until the next sync. Now correctly advances to workout end time, ensuring proper incremental sync.
This commit is contained in:
+2
-2
@@ -672,11 +672,11 @@ class HealthConnectUtils {
|
||||
val deviceEntity = DBHelper.getDevice(device, db.daoSession) ?: return null
|
||||
return db.daoSession.baseActivitySummaryDao?.queryBuilder()
|
||||
?.where(BaseActivitySummaryDao.Properties.DeviceId.eq(deviceEntity.id))
|
||||
?.orderDesc(BaseActivitySummaryDao.Properties.StartTime)
|
||||
?.orderDesc(BaseActivitySummaryDao.Properties.EndTime)
|
||||
?.limit(1)
|
||||
?.list()
|
||||
?.firstOrNull()
|
||||
?.startTime?.toInstant()
|
||||
?.endTime?.toInstant()
|
||||
}
|
||||
else -> {
|
||||
CompanionLogger.error("No suitable provider found or provider is null for getLastSampleTimestamp, dataType: {}, device: {}", dataType, device.name)
|
||||
|
||||
Reference in New Issue
Block a user