diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart index f2a8dd931..e3b2d56c5 100644 --- a/mobile/lib/face/db.dart +++ b/mobile/lib/face/db.dart @@ -444,9 +444,9 @@ class FaceMLDataDB { Future resetClusterIDs() async { final db = await instance.database; - await db.rawQuery(dropFaceClustersTable); - await db.rawQuery(createFaceClustersTable); - await db.rawQuery(fcClusterIDIndex); + await db.execute(dropFaceClustersTable); + await db.execute(createFaceClustersTable); + await db.execute(fcClusterIDIndex); } Future insert(Person p, int cluserID) async { @@ -647,6 +647,7 @@ class FaceMLDataDB { await db.execute(createFacesTable); await db.execute(dropFaceClustersTable); await db.execute(createFaceClustersTable); + await db.execute(fcClusterIDIndex); } await db.execute(deletePersonTable); await db.execute(dropClusterPersonTable); diff --git a/mobile/lib/face/db_fields.dart b/mobile/lib/face/db_fields.dart index ba21046aa..379845f08 100644 --- a/mobile/lib/face/db_fields.dart +++ b/mobile/lib/face/db_fields.dart @@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS $faceClustersTable ( '''; // -- Creating a non-unique index on clusterID for query optimization const fcClusterIDIndex = - '''CREATE INDEX IF NOT EXISTS idx_fcClusterID ON faceClustersTable(fcClusterID);'''; + '''CREATE INDEX IF NOT EXISTS idx_fcClusterID ON $faceClustersTable($fcClusterID);'''; const dropFaceClustersTable = 'DROP TABLE IF EXISTS $faceClustersTable'; //##endregion diff --git a/mobile/lib/ui/settings/debug/face_debug_section_widget.dart b/mobile/lib/ui/settings/debug/face_debug_section_widget.dart index dd0561fc0..5a76320c3 100644 --- a/mobile/lib/ui/settings/debug/face_debug_section_widget.dart +++ b/mobile/lib/ui/settings/debug/face_debug_section_widget.dart @@ -181,7 +181,7 @@ class _FaceDebugSectionWidgetState extends State { sectionOptionSpacing, MenuItemWidget( captionedTextWidget: const CaptionedTextWidget( - title: "Reset feedback & labels", + title: "Reset feedback & clusters", ), pressedColor: getEnteColorScheme(context).fillFaint, trailingIcon: Icons.chevron_right_outlined, @@ -194,10 +194,15 @@ class _FaceDebugSectionWidgetState extends State { "You will need to again cluster all the faces. You can drop feedback if you want to return to original cluster labels", firstButtonLabel: "Yes, confirm", firstButtonOnTap: () async { - await FaceMLDataDB.instance.resetClusterIDs(); - await FaceMLDataDB.instance.dropClustersAndPersonTable(); - Bus.instance.fire(PeopleChangedEvent()); - showShortToast(context, "Done"); + try { + await FaceMLDataDB.instance.resetClusterIDs(); + await FaceMLDataDB.instance.dropClustersAndPersonTable(); + Bus.instance.fire(PeopleChangedEvent()); + showShortToast(context, "Done"); + } catch (e, s) { + _logger.warning('reset feedback failed ', e, s); + await showGenericErrorDialog(context: context, error: e); + } }, ); },