Expose parseDouble; fix shift mapping and UI
Rename and expose numeric parser (from _parseDouble to parseDouble) with a doc comment so other modules can reuse it. Update ClockIn repository mapping to populate orderId and prefer clientName for the shift title, and map latitude/longitude using Shift.parseDouble. Remove outdated TODOs and remove the selected/today badge text from the shift card UI. These changes consolidate parsing logic, improve today-shift mapping fidelity, and simplify the shift card display.
This commit is contained in:
@@ -39,8 +39,8 @@ class Shift extends Equatable {
|
||||
timezone: json['timezone'] as String? ?? 'UTC',
|
||||
locationName: json['locationName'] as String?,
|
||||
locationAddress: json['locationAddress'] as String?,
|
||||
latitude: _parseDouble(json['latitude']),
|
||||
longitude: _parseDouble(json['longitude']),
|
||||
latitude: parseDouble(json['latitude']),
|
||||
longitude: parseDouble(json['longitude']),
|
||||
geofenceRadiusMeters: json['geofenceRadiusMeters'] as int?,
|
||||
requiredWorkers: json['requiredWorkers'] as int? ?? 1,
|
||||
assignedWorkers: json['assignedWorkers'] as int? ?? 0,
|
||||
@@ -114,7 +114,8 @@ class Shift extends Equatable {
|
||||
};
|
||||
}
|
||||
|
||||
static double? _parseDouble(dynamic value) {
|
||||
/// Safely parses a numeric value to double.
|
||||
static double? parseDouble(dynamic value) {
|
||||
if (value == null) return null;
|
||||
if (value is double) return value;
|
||||
if (value is int) return value.toDouble();
|
||||
|
||||
Reference in New Issue
Block a user