finalize groups #437

Merged
simon merged 4 commits from feature/finalize-groups into main 2026-02-23 17:27:49 +01:00
Owner

Description of the implemented changes

The changes were:

  • Bugfixing
  • New Feature
  • Breaking Change
  • Refactoring

Refactoring of the Group Show LiveView (add-member flow and tests) plus small feature: dev seeds for groups.


What has been changed?

Group Show LiveView (lib/mv_web/live/group_live/show.ex)

  • Performance: Add-member flow no longer hits the DB on focus or on every keystroke. When the user opens “Add Member”, candidates are loaded once (single read, limit 300). Search/filter while typing is done in memory via filter_candidates_in_memory/2 (by name/email using MemberHelpers.display_name/1). New assign: add_member_candidates.
  • Authorization: can?/3 now uses the loaded @group instead of Mv.Membership.Group for update/destroy (e.g. can?(@current_user, :update, @group)), so policies run on the actual resource.
  • Testability: Added data-testid on: edit button, delete button, member count paragraph, member search input, add-selected-members button, “no members” text, members table wrapper, remove-member buttons.
  • Copy: Error flash text changed from “Could not load member search…” to “Could not load member list…” (aligned with in-memory list).
  • i18n: German error message uses informal “du” (“Bitte versuche es erneut”) per project guideline.

Seeds (priv/repo/seeds.exs)

  • Idempotent creation of example groups: Vorstand, Trainer*innen, Jugend, Newsletter (create only if name does not exist).
  • Idempotent assignment of seed members to these groups (e.g. Hans Müller → Vorstand, Newsletter; Greta Schmidt → Jugend, Newsletter; etc.). Duplicate create_member_group calls are skipped.
  • Minor alias reorder (Accounts, Membership, CycleGenerator, MembershipFeeType).

Code guidelines (CODE_GUIDELINES.md)

  • Documented that German (de) user-facing strings use informal “duzen” (e.g. “Bitte versuche es erneut”, “Deine Einstellungen”).

Gettext

  • Removed “Could not load member search. Please try again.”
  • Added “Could not load member list. Please try again.” with DE “Mitgliederliste konnte nicht geladen werden. Bitte versuche es erneut.”
  • Cleaned obsolete/fuzzy entries in PO files.

Tests

  • Group Show tests updated to use data-testid selectors where relevant (show_add_member_test, show_authorization_test, show_member_search_test, show_remove_member_test, show_test, show_accessibility_test, show_add_remove_members_test, show_integration_test).
  • Comments added for i18n OR-chains and intent in form_test, index_test, integration_test.
  • Net result: fewer lines, same coverage, more stable selectors.

Definition of Done

Code Quality

  • No new technical depths
  • Linting passed
  • Documentation is added were needed

Accessibility

  • New elements are properly defined with html-tags
  • Colour contrast follows WCAG criteria
  • Aria labels are added when needed
  • Everything is accessible by keyboard
  • Tab-Order is comprehensible
  • All interactive elements have a visible focus

Testing

  • Tests for new code are written
  • All tests pass
  • axe-core dev tools show no critical or major issues

Additional Notes

## Description of the implemented changes The changes were: - [ ] Bugfixing - [ ] New Feature - [x] Breaking Change - [x] Refactoring **Refactoring of the Group Show LiveView (add-member flow and tests) plus small feature: dev seeds for groups.** --- ## What has been changed? **Group Show LiveView (`lib/mv_web/live/group_live/show.ex`)** - **Performance:** Add-member flow no longer hits the DB on focus or on every keystroke. When the user opens “Add Member”, candidates are loaded once (single read, limit 300). Search/filter while typing is done in memory via `filter_candidates_in_memory/2` (by name/email using `MemberHelpers.display_name/1`). New assign: `add_member_candidates`. - **Authorization:** `can?/3` now uses the loaded `@group` instead of `Mv.Membership.Group` for update/destroy (e.g. `can?(@current_user, :update, @group)`), so policies run on the actual resource. - **Testability:** Added `data-testid` on: edit button, delete button, member count paragraph, member search input, add-selected-members button, “no members” text, members table wrapper, remove-member buttons. - **Copy:** Error flash text changed from “Could not load member search…” to “Could not load member list…” (aligned with in-memory list). - **i18n:** German error message uses informal “du” (“Bitte versuche es erneut”) per project guideline. **Seeds (`priv/repo/seeds.exs`)** - Idempotent creation of example groups: Vorstand, Trainer*innen, Jugend, Newsletter (create only if name does not exist). - Idempotent assignment of seed members to these groups (e.g. Hans Müller → Vorstand, Newsletter; Greta Schmidt → Jugend, Newsletter; etc.). Duplicate `create_member_group` calls are skipped. - Minor alias reorder (Accounts, Membership, CycleGenerator, MembershipFeeType). **Code guidelines (`CODE_GUIDELINES.md`)** - Documented that German (de) user-facing strings use informal “duzen” (e.g. “Bitte versuche es erneut”, “Deine Einstellungen”). **Gettext** - Removed “Could not load member search. Please try again.” - Added “Could not load member list. Please try again.” with DE “Mitgliederliste konnte nicht geladen werden. Bitte versuche es erneut.” - Cleaned obsolete/fuzzy entries in PO files. **Tests** - Group Show tests updated to use `data-testid` selectors where relevant (show_add_member_test, show_authorization_test, show_member_search_test, show_remove_member_test, show_test, show_accessibility_test, show_add_remove_members_test, show_integration_test). - Comments added for i18n OR-chains and intent in form_test, index_test, integration_test. - Net result: fewer lines, same coverage, more stable selectors. --- ## Definition of Done ### Code Quality - [ ] No new technical depths - [ ] Linting passed - [ ] Documentation is added were needed ### Accessibility - [ ] New elements are properly defined with html-tags - [ ] Colour contrast follows WCAG criteria - [ ] Aria labels are added when needed - [ ] Everything is accessible by keyboard - [ ] Tab-Order is comprehensible - [ ] All interactive elements have a visible focus ### Testing - [ ] Tests for new code are written - [ ] All tests pass - [ ] axe-core dev tools show no critical or major issues --- ## Additional Notes
simon added 4 commits 2026-02-20 17:19:00 +01:00
refactor: add data-testid selectors for groups ui
Some checks failed
continuous-integration/drone/push Build is failing
123227a50e
chore: add dev db seeds for groups
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production Build is passing
8430069b45
simon added this to the Sprint 13: 19.02-26.02 project 2026-02-20 17:19:01 +01:00
simon merged commit be9d12f181 into main 2026-02-23 17:27:49 +01:00
Sign in to join this conversation.
No description provided.