mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
manually parse event date for heatmap date object.
This commit is contained in:
@ -14,13 +14,16 @@ class OccupancyHeatMapModel extends Equatable {
|
|||||||
});
|
});
|
||||||
|
|
||||||
factory OccupancyHeatMapModel.fromJson(Map<String, dynamic> json) {
|
factory OccupancyHeatMapModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
final eventDate = json['event_date'] as String? ?? '${DateTime.now()}';
|
||||||
|
final year = eventDate.split('-')[0];
|
||||||
|
final month = eventDate.split('-')[1];
|
||||||
|
final day = eventDate.split('-')[2];
|
||||||
|
|
||||||
return OccupancyHeatMapModel(
|
return OccupancyHeatMapModel(
|
||||||
uuid: json['uuid'] as String? ?? '',
|
uuid: json['uuid'] as String? ?? '',
|
||||||
eventDate: DateTime.parse(
|
eventDate: DateTime(int.parse(year), int.parse(month), int.parse(day)),
|
||||||
json['event_date'] as String? ?? '${DateTime.now()}',
|
|
||||||
),
|
|
||||||
countTotalPresenceDetected: num.parse(
|
countTotalPresenceDetected: num.parse(
|
||||||
json['count_total_presence_detected']?.toString() ?? '900',
|
json['count_total_presence_detected']?.toString() ?? '0',
|
||||||
).toInt(),
|
).toInt(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user