Prevent importing duplicate saved searches

This commit is contained in:
M66B
2022-12-31 10:46:25 +01:00
parent df05998a60
commit 20858227fc
2 changed files with 14 additions and 3 deletions

View File

@@ -1118,8 +1118,18 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
for (int s = 0; s < jsearches.length(); s++) {
JSONObject jsearch = (JSONObject) jsearches.get(s);
EntitySearch search = EntitySearch.fromJSON(jsearch);
search.id = null;
db.search().insertSearch(search);
boolean found = false;
for (EntitySearch other : db.search().getSearches())
if (other.equals(search)) {
found = true;
break;
}
if (!found) {
search.id = null;
db.search().insertSearch(search);
}
}
}