[mob] Debug option to reset feedback
This commit is contained in:
parent
7f66bd2ed0
commit
a3b6a72315
2 changed files with 41 additions and 4 deletions
|
@ -681,6 +681,20 @@ class FaceMLDataDB {
|
|||
await db.execute(createClusterSummaryTable);
|
||||
}
|
||||
|
||||
/// WARNING: This will delete ALL data in the database! Only use this for debug/testing purposes!
|
||||
Future<void> dropPeople() async {
|
||||
final db = await instance.database;
|
||||
|
||||
await db.execute(deletePeopleTable);
|
||||
await db.execute(dropClustersTable);
|
||||
await db.execute(dropNotPersonFeedbackTable);
|
||||
|
||||
// await db.execute(createFacesTable);
|
||||
await db.execute(createPeopleTable);
|
||||
await db.execute(createClusterTable);
|
||||
await db.execute(createNotPersonFeedbackTable);
|
||||
}
|
||||
|
||||
Future<void> removePersonFromFiles(List<EnteFile> files, Person p) async {
|
||||
final db = await instance.database;
|
||||
final result = await db.rawQuery(
|
||||
|
|
|
@ -165,6 +165,20 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {
|
|||
},
|
||||
),
|
||||
sectionOptionSpacing,
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: const CaptionedTextWidget(
|
||||
title: "Reset feedback",
|
||||
),
|
||||
pressedColor: getEnteColorScheme(context).fillFaint,
|
||||
trailingIcon: Icons.chevron_right_outlined,
|
||||
trailingIconIsMuted: true,
|
||||
onTap: () async {
|
||||
await FaceMLDataDB.instance.dropPeople();
|
||||
Bus.instance.fire(PeopleChangedEvent());
|
||||
showShortToast(context, "Done");
|
||||
},
|
||||
),
|
||||
sectionOptionSpacing,
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: const CaptionedTextWidget(
|
||||
title: "Reset feedback & labels",
|
||||
|
@ -173,10 +187,19 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {
|
|||
trailingIcon: Icons.chevron_right_outlined,
|
||||
trailingIconIsMuted: true,
|
||||
onTap: () async {
|
||||
await FaceMLDataDB.instance.resetClusterIDs();
|
||||
await FaceMLDataDB.instance.dropClustersAndPeople();
|
||||
Bus.instance.fire(PeopleChangedEvent());
|
||||
showShortToast(context, "Done");
|
||||
await showChoiceDialog(
|
||||
context,
|
||||
title: "Are you sure?",
|
||||
body:
|
||||
"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.dropClustersAndPeople();
|
||||
Bus.instance.fire(PeopleChangedEvent());
|
||||
showShortToast(context, "Done");
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
sectionOptionSpacing,
|
||||
|
|
Loading…
Add table
Reference in a new issue