Cultures + Lieux: delete varieties and locations (guarded)#89
Merged
Conversation
More pre-prod feedback: a variety couldn't be removed, and a location couldn't be edited/deleted. Both screens lacked the affordance. - **Variety delete**: each variety row gets a Supprimer button; blocked (localized) when a planting uses the variety (FK RESTRICT). `delete_variety` + `VarietyRow.in_use`. - **Location delete**: each location row gets a Supprimer button; **blocked when the location holds child locations OR plantings** (both FKs are RESTRICT), exactly as requested — `in_use` disables the button and `delete_location` refuses with a localized message. `LocationListItem.in_use` computed from children + plantings. - Routed through the shared confirmation dialog (#61); new i18n keys (fr/en). Tests: delete_variety (unplanted ok / planted refused), delete_location (unused leaf ok / has-children refused / has-planting refused). Workspace green, clippy + fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continued pre-production feedback: a variety couldn't be removed, and a location couldn't be deleted — both screens lacked the affordance (same gap as crops had).
Changes
planting.variety_idisON DELETE RESTRICT).delete_variety+VarietyRow.in_usedisables the button.in_usedisables the button anddelete_locationrefuses with a localized message.LocationListItem.in_useis computed from children + plantings.Verification
delete_variety(unplanted → ok, planted → refused),delete_location(unused leaf → ok, has-children → refused, has-planting → refused).cargo test --workspace(335) green,cargo clippy --workspace --all-targets+cargo fmt --checkclean.🤖 Generated with Claude Code