This commit is contained in:
Faris Armoush
2025-05-22 15:44:19 +03:00
parent 4c5b390887
commit d43c1847ff
2 changed files with 4 additions and 20 deletions

View File

@ -28,7 +28,7 @@ final class AirQualityDataLoadingStrategy implements AnalyticsDataLoadingStrateg
final isSpaceSelected = selectedSpacesIds.contains(space.uuid);
if (selectedSpacesIds.isEmpty) {
spaceTreeBloc.add(OnCommunitySelected(community.uuid, [space]));
spaceTreeBloc.add(OnSpaceSelected(community, space.uuid ?? '', []));
} else if (isSpaceSelected) {
spaceTreeBloc.add(const SpaceTreeClearSelectionEvent());
} else {

View File

@ -14,23 +14,7 @@ class OccupancyDataLoadingStrategy implements AnalyticsDataLoadingStrategy {
CommunityModel community,
List<SpaceModel> spaces,
) {
context.read<SpaceTreeBloc>().add(
OnCommunitySelected(
community.uuid,
spaces.isNotEmpty ? [spaces.first] : [],
),
);
final spaceTreeState = context.read<SpaceTreeBloc>().state;
if (spaceTreeState.selectedCommunities.contains(community.uuid)) {
clearData(context);
return;
}
FetchOccupancyDataHelper.loadOccupancyData(
context,
communityId: community.uuid,
spaceId: spaces.isNotEmpty ? spaces.first.uuid ?? '' : '',
);
// Do nothing
}
@override
@ -44,7 +28,7 @@ class OccupancyDataLoadingStrategy implements AnalyticsDataLoadingStrategy {
final isSpaceSelected = selectedSpacesIds.contains(space.uuid);
if (selectedSpacesIds.isEmpty) {
spaceTreeBloc.add(OnCommunitySelected(community.uuid, [space]));
spaceTreeBloc.add(OnSpaceSelected(community, space.uuid ?? '', []));
} else if (isSpaceSelected) {
spaceTreeBloc.add(const SpaceTreeClearSelectionEvent());
} else {
@ -73,7 +57,7 @@ class OccupancyDataLoadingStrategy implements AnalyticsDataLoadingStrategy {
CommunityModel community,
SpaceModel child,
) {
// Do nothing
if (child.children.isNotEmpty) return onSpaceSelected(context, community, child);
}
@override