fix(dive-log): persist picked buddy role in bulk edit#701
Open
mgoodness wants to merge 1 commit into
Open
Conversation
Bulk-adding buddies to multiple dives let you pick a role in the picker, but the pick was thrown away when stored into the generic membership-editor state, then hardcoded back to the default "buddy" role at save time. Thread the picked DiveRole through instead. Fixes submersion-app#699
Contributor
|
📦 Build artifacts for this PR · commit
Artifacts expire in 7 days. Downloading requires being signed in to GitHub. The macOS build is ad-hoc signed — right-click → Open on first launch. Updated automatically on each push. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Bulk-editing multiple dives and adding a buddy let you pick a role (Divemaster, Instructor, etc.) via the picker, but the pick was discarded — every newly-added buddy was always saved with the default "Buddy" role.
Fixes #699
Related to #700
Changes
_addBuddyMembersnow records the picked role in a new_buddyRoleByIdmap (alongside the existing_buddyById), instead of only capturingid/label/icon._buddyWithRolelooks up the picked role from that map when building the save payload, falling back to the defaultBuddyrole only when unknown.BuddyRepository.getBuddiesForDive.Known limitation, filed separately: this fix covers adding a new buddy to the selection. Re-picking a buddy who's already on some/all of the selected dives with a different role still doesn't update it — see #700 for that follow-up.
Test Plan
flutter testpasses (full suite:dive_edit_page_test.dart,bulk_dive_edit_page_test.dart,bulk_dive_edit_service_test.dart,bulk_dive_edit_provider_test.dart,buddies/tree — 240 tests)flutter analyzepasses