mirror of
https://github.com/SyncrowIOT/web.git
synced 2026-10-25 07:37:57 +00:00
Merge branch 'dev' into 1511-occupancy-heat-map-tooltip
This commit is contained in:
@@ -14,7 +14,7 @@ import 'package:syncrow_web/pages/analytics/modules/occupancy/blocs/occupancy_he
|
||||
import 'package:syncrow_web/pages/analytics/services/energy_consumption_by_phases/fake_energy_consumption_by_phases_service.dart';
|
||||
import 'package:syncrow_web/pages/analytics/services/energy_consumption_per_device/fake_energy_consumption_per_device_service.dart';
|
||||
import 'package:syncrow_web/pages/analytics/services/occupacy/fake_occupacy_service.dart';
|
||||
import 'package:syncrow_web/pages/analytics/services/occupancy_heat_map/fake_occupancy_heat_map_service.dart';
|
||||
import 'package:syncrow_web/pages/analytics/services/occupancy_heat_map/remote_occupancy_heat_map_service.dart';
|
||||
import 'package:syncrow_web/pages/analytics/services/power_clamp_info/remote_power_clamp_info_service.dart';
|
||||
import 'package:syncrow_web/pages/analytics/services/realtime_device_service/firebase_realtime_device_service.dart';
|
||||
import 'package:syncrow_web/pages/analytics/services/total_energy_consumption/remote_total_energy_consumption_service.dart';
|
||||
@@ -60,7 +60,9 @@ class AnalyticsPage extends StatelessWidget {
|
||||
),
|
||||
BlocProvider(create: (context) => OccupancyBloc(FakeOccupacyService())),
|
||||
BlocProvider(
|
||||
create: (context) => OccupancyHeatMapBloc(FakeOccupancyHeatMapService()),
|
||||
create: (context) => OccupancyHeatMapBloc(
|
||||
RemoteOccupancyHeatMapService(HTTPService()),
|
||||
),
|
||||
),
|
||||
BlocProvider(create: (context) => AnalyticsDatePickerBloc()),
|
||||
],
|
||||
|
||||
@@ -35,8 +35,7 @@ abstract final class FetchOccupancyDataHelper {
|
||||
context.read<OccupancyHeatMapBloc>().add(
|
||||
LoadOccupancyHeatMapEvent(
|
||||
GetOccupancyHeatMapParam(
|
||||
spaceId: spaceId,
|
||||
communityId: communityId,
|
||||
spaceUuid: spaceId,
|
||||
year: datePickerState.yearlyDate,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -15,8 +15,9 @@ class OccupancyHeatMap extends StatelessWidget {
|
||||
static const _cellSize = 16.0;
|
||||
static const _totalWeeks = 53;
|
||||
|
||||
int get _maxValue =>
|
||||
heatMapData.isNotEmpty ? heatMapData.values.reduce(math.max) : 0;
|
||||
int get _maxValue => heatMapData.isNotEmpty
|
||||
? heatMapData.keys.map((key) => heatMapData[key] ?? 0).reduce(math.max)
|
||||
: 0;
|
||||
|
||||
DateTime _getStartingDate() {
|
||||
final jan1 = DateTime(DateTime.now().year, 1, 1);
|
||||
|
||||
@@ -68,7 +68,10 @@ class OccupancyHeatMapBox extends StatelessWidget {
|
||||
Expanded(
|
||||
child: OccupancyHeatMap(
|
||||
heatMapData: state.heatMapData.asMap().map(
|
||||
(_, value) => MapEntry(value.date, value.occupancy),
|
||||
(_, value) => MapEntry(
|
||||
value.eventDate,
|
||||
value.countTotalPresenceDetected,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user