Fixed the fucky that always deleted tags on import/sync
parent
d9773c9fc2
commit
63675ee055
|
|
@ -47,7 +47,11 @@ fun parseRecipeFiles(ctx: MainActivity) {
|
|||
}
|
||||
|
||||
// Clearing unused tags after an import/sync
|
||||
val usedTags = ctx.recipeView.tagFilters.value.map { t -> t.tag }
|
||||
val usedTags = ctx.db.recipeWithTagsDao().getAll()
|
||||
.asSequence()
|
||||
.flatMap { it.tags }
|
||||
.map { it.name }
|
||||
.toList()
|
||||
for (tag in ctx.db.tagDao().getAll()) {
|
||||
if (!usedTags.contains(tag.name)) {
|
||||
ctx.db.tagDao().delete(tag.name)
|
||||
|
|
|
|||
Loading…
Reference in New Issue