mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
manually parse event date for heatmap date object. (#300)
<!-- Thanks for contributing! Provide a description of your changes below and a general summary in the title Please look at the following checklist to ensure that your PR can be accepted quickly: --> ## Description <!--- Describe your changes in detail --> ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [ ] ✨ New feature (non-breaking change which adds functionality) - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) - [ ] 🧹 Code refactor - [ ] ✅ Build configuration change - [ ] 📝 Documentation - [ ] 🗑️ Chore
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