Round accuracyMeters before serialization

Round accuracyMeters to an integer when building payloads to ensure consistent, integer accuracy values sent to the backend. Updates made in background_geofence_service.dart (location.accuracy.round()) and in ClockInArguments/ClockOutArguments (round accuracyMeters when present) so nullable values are rounded before serialization.
This commit is contained in:
Achintha Isuru
2026-03-18 16:31:12 -04:00
parent ff262853a2
commit d13cabb30d
3 changed files with 3 additions and 3 deletions

View File

@@ -174,7 +174,7 @@ Future<void> _postLocationStream({
'capturedAt': location.timestamp.toUtc().toIso8601String(), 'capturedAt': location.timestamp.toUtc().toIso8601String(),
'latitude': location.latitude, 'latitude': location.latitude,
'longitude': location.longitude, 'longitude': location.longitude,
'accuracyMeters': location.accuracy, 'accuracyMeters': location.accuracy.round(),
}, },
], ],
'metadata': <String, String>{'source': 'background-workmanager'}, 'metadata': <String, String>{'source': 'background-workmanager'},

View File

@@ -71,7 +71,7 @@ class ClockInArguments extends UseCaseArgument {
if (deviceId != null) 'deviceId': deviceId, if (deviceId != null) 'deviceId': deviceId,
if (latitude != null) 'latitude': latitude, if (latitude != null) 'latitude': latitude,
if (longitude != null) 'longitude': longitude, if (longitude != null) 'longitude': longitude,
if (accuracyMeters != null) 'accuracyMeters': accuracyMeters, if (accuracyMeters != null) 'accuracyMeters': accuracyMeters!.round(),
if (capturedAt != null) if (capturedAt != null)
'capturedAt': capturedAt!.toUtc().toIso8601String(), 'capturedAt': capturedAt!.toUtc().toIso8601String(),
if (overrideReason != null && overrideReason!.isNotEmpty) if (overrideReason != null && overrideReason!.isNotEmpty)

View File

@@ -75,7 +75,7 @@ class ClockOutArguments extends UseCaseArgument {
if (deviceId != null) 'deviceId': deviceId, if (deviceId != null) 'deviceId': deviceId,
if (latitude != null) 'latitude': latitude, if (latitude != null) 'latitude': latitude,
if (longitude != null) 'longitude': longitude, if (longitude != null) 'longitude': longitude,
if (accuracyMeters != null) 'accuracyMeters': accuracyMeters, if (accuracyMeters != null) 'accuracyMeters': accuracyMeters!.round(),
if (capturedAt != null) if (capturedAt != null)
'capturedAt': capturedAt!.toUtc().toIso8601String(), 'capturedAt': capturedAt!.toUtc().toIso8601String(),
if (overrideReason != null && overrideReason!.isNotEmpty) if (overrideReason != null && overrideReason!.isNotEmpty)