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:
@@ -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'},
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user