[mob] Fetch remote entities before running clustering

This commit is contained in:
Neeraj Gupta 2024-04-05 16:04:58 +05:30
parent 7c6001321f
commit bb3a37adf5
2 changed files with 11 additions and 5 deletions

View file

@ -85,6 +85,7 @@ class PersonService {
}
Future<void> storeRemoteFeedback() async {
await entityService.syncEntities();
final entities = await entityService.getEntities(EntityType.person);
entities.sort((a, b) => a.updatedAt.compareTo(b.updatedAt));
final Map<String, int> faceIdToClusterID = {};

View file

@ -161,11 +161,16 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
await PersonService.instance.storeRemoteFeedback();
await FaceMlService.instance
.clusterAllImages(clusterInBuckets: true);
Bus.instance.fire(PeopleChangedEvent());
showShortToast(context, "Done");
try {
await PersonService.instance.storeRemoteFeedback();
await FaceMlService.instance
.clusterAllImages(clusterInBuckets: true);
Bus.instance.fire(PeopleChangedEvent());
showShortToast(context, "Done");
} catch (e, s) {
_logger.warning('clustering failed ', e, s);
await showGenericErrorDialog(context: context, error: e);
}
},
),
sectionOptionSpacing,