mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
uses UTC dates as an attempt to fix heatmap's rendering bug.
This commit is contained in:
@ -21,11 +21,11 @@ class OccupancyHeatMapModel extends Equatable {
|
||||
|
||||
return OccupancyHeatMapModel(
|
||||
uuid: json['uuid'] as String? ?? '',
|
||||
eventDate: DateTime(
|
||||
eventDate: DateTime.utc(
|
||||
int.parse(year ?? '2025'),
|
||||
int.parse(month ?? '1'),
|
||||
int.parse(day ?? '1'),
|
||||
).toUtc(),
|
||||
),
|
||||
countTotalPresenceDetected: num.parse(
|
||||
json['count_total_presence_detected']?.toString() ?? '0',
|
||||
).toInt(),
|
||||
|
@ -20,14 +20,14 @@ class OccupancyHeatMap extends StatelessWidget {
|
||||
: 0;
|
||||
|
||||
DateTime _getStartingDate() {
|
||||
final jan1 = DateTime(DateTime.now().year, 1, 1).toUtc();
|
||||
final jan1 = DateTime.utc(DateTime.now().year, 1, 1);
|
||||
final startOfWeek = jan1.subtract(Duration(days: jan1.weekday - 1));
|
||||
return startOfWeek;
|
||||
}
|
||||
|
||||
List<OccupancyPaintItem> _generatePaintItems(DateTime startDate) {
|
||||
return List.generate(_totalWeeks * 7, (index) {
|
||||
final date = startDate.toUtc().add(Duration(days: index));
|
||||
final date = startDate.add(Duration(days: index));
|
||||
final value = heatMapData[date] ?? 0;
|
||||
return OccupancyPaintItem(index: index, value: value, date: date);
|
||||
});
|
||||
|
Reference in New Issue
Block a user