Unset category as category for unused apps when deleting category

This commit is contained in:
Jonas L 2019-01-25 07:41:04 +01:00
parent fe062ecaa0
commit 5613029416
2 changed files with 4 additions and 0 deletions

View file

@ -62,4 +62,7 @@ abstract class UserDao {
@Query("UPDATE user SET category_for_not_assigned_apps = :categoryId WHERE id = :childId")
abstract fun updateCategoryForUnassignedApps(childId: String, categoryId: String)
@Query("UPDATE user SET category_for_not_assigned_apps = \"\" WHERE category_for_not_assigned_apps = :categoryId")
abstract fun removeAsCategoryForUnassignedApps(categoryId: String)
}

View file

@ -83,6 +83,7 @@ object LocalDatabaseParentActionDispatcher {
database.timeLimitRules().deleteTimeLimitRulesByCategory(action.categoryId)
database.usedTimes().deleteUsedTimeItems(action.categoryId)
database.categoryApp().deleteCategoryAppsByCategoryId(action.categoryId)
database.user().removeAsCategoryForUnassignedApps(action.categoryId)
database.category().deleteCategory(action.categoryId)
}
is UpdateCategoryTitleAction -> {