Assign category positions inside the database

A new category's position is computed by its insert, one after the highest, so two categories created at once can't take the same one. Inserts take a NewCategory rather than a Category whose id and position would be ignored. Reordering places any category missing from the given order after the rest instead of leaving it at a stale position. Restore still creates missing categories all or none, in backup order, and the create dialog no longer accepts an empty name.
This commit is contained in:
AntsyLich
2026-09-27 22:53:09 +06:00
parent fc5592ff75
commit 8bfa495f34
8 changed files with 42 additions and 46 deletions
@@ -110,7 +110,7 @@ fun CategoryRenameDialog(
onDismissRequest = onDismissRequest,
confirmButton = {
TextButton(
enabled = valueHasChanged && !nameAlreadyExists,
enabled = valueHasChanged && name.isNotEmpty() && !nameAlreadyExists,
onClick = {
onRename(name)
onDismissRequest()