Commit graph

544 commits

Author SHA1 Message Date
9c18be61a8
test: remove Process.sleep from type change integration tests 2025-12-18 15:00:42 +01:00
0e8f492800
fix: prevent nil assignment for membership_fee_type_id
Reject attempts to set membership_fee_type_id to nil when a current type
exists.
2025-12-18 15:00:42 +01:00
6183fc6978
fix: implement fail-closed behavior in ValidateSameInterval
Change validation to fail closed instead of fail open when types cannot
be loaded. This prevents inconsistent data states and provides clearer
error messages to users.
2025-12-18 15:00:42 +01:00
69c9746974
fix: make cycle regeneration atomic on type change
Make cycle regeneration synchronous in the same transaction as the member
update to ensure atomicity.
2025-12-18 15:00:42 +01:00
f6e2ecd74b
refactor: reduce nesting depth and improve code readability
- Replace Enum.map |> Enum.join with Enum.map_join for efficiency
- Extract helper functions to reduce nesting depth from 4 to 2
- Rename is_current_cycle? to current_cycle? following Elixir conventions
2025-12-18 15:00:41 +01:00
b9fb115eb5
feat: regenerate cycles when membership fee type changes (same interval)
- Implemented regenerate_cycles_on_type_change helper in Member resource
- Cycles that haven't ended yet (cycle_end >= today) are deleted and regenerated
- Paid and suspended cycles remain unchanged (not deleted)
- CycleGenerator reloads member with new membership_fee_type_id
- Adjusted tests to work with current cycles only (no future cycles)
- All integration tests passing

Phase 4 completed: Cycle regeneration on type change
2025-12-18 15:00:41 +01:00
3177ea20dd
feat: add validation for same-interval membership fee type changes 2025-12-18 15:00:41 +01:00
43ec281242
feat: add cycle status calculations to Member resource 2025-12-18 15:00:41 +01:00
910a91aa74
feat: add status management actions to MembershipFeeCycle 2025-12-18 15:00:41 +01:00
ac786662b1 Merge pull request 'Membership Fee Type Resource & Settings closes #278' (#291) from feature/278_membership_fee_settings into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #291
2025-12-18 14:17:09 +01:00
d75e2b7a46 feat: add 4 example membership fee types to seed script
All checks were successful
continuous-integration/drone/push Build is passing
2025-12-18 11:54:23 +01:00
820ead3429 chore: update gettext 2025-12-18 11:54:23 +01:00
f0e1d3fade docs: document require_atomic? false in MembershipFeeType actions 2025-12-18 11:54:23 +01:00
78b5335456 refactor: migrate MembershipFeeSettingsLive to AshPhoenix.Form 2025-12-18 11:54:23 +01:00
511f52fba8 feat: improve error handling in settings validation for default_membership_fee_type_id 2025-12-18 11:54:23 +01:00
4813d6080b feat: prevent deletion of membership fee type when used as default in settings 2025-12-18 11:54:23 +01:00
97bba4c218 refactor: use Enum.map_join instead of Enum.map |> Enum.join 2025-12-18 11:54:23 +01:00
283f824f4d fix: improve accessibility - WCAG 2 AA contrast and select label 2025-12-18 11:54:23 +01:00
630b51ac34 refactor: replace ContributionSettingsLive mockup with MembershipFeeSettingsLive in navigation 2025-12-18 11:54:23 +01:00
f7d23ee7fe i18n: add German translations for membership fee settings 2025-12-18 11:54:23 +01:00
e135a6cdbf feat: implement full CRUD for membership fee types with settings UI
- Add interval immutability and deletion prevention validations
- Add settings validation for default_membership_fee_type_id
- Create MembershipFeeSettingsLive for admin UI with form handling
- Add comprehensive test coverage (unit, integration, settings)
2025-12-18 11:54:23 +01:00
ff39448fd6 Merge pull request 'Cycle Generation System closes #277' (#290) from feature/277_cycle_generation into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #290
Reviewed-by: carla <carla@noreply.git.local-it.org>
2025-12-18 11:53:10 +01:00
ed083830b9 refactor: improve cycle generation code quality and documentation
All checks were successful
continuous-integration/drone/push Build is passing
- Remove Process.sleep calls from integration tests (tests run synchronously in SQL sandbox)
- Improve error handling: membership_fee_type_not_found now returns changeset error instead of just logging
- Clarify partial_failure documentation: successful_cycles are not persisted on rollback
- Update documentation: joined_at → join_date, left_at → exit_date
- Document PostgreSQL advisory locks per member (not whole table lock)
- Document gap handling: explicitly deleted cycles are not recreated
2025-12-16 16:40:11 +01:00
62a2bd41ea fix: handle Ash notifications in CycleGenerator transactions
- Use return_notifications?: true when creating cycles within transaction
- Collect notifications and send them after transaction commits
- Prevents 'Missed notifications' warnings in test output
- Notifications are now properly sent via Ash.Notifier.notify/1
2025-12-16 16:40:11 +01:00
d9ca6b1763 test: fix date dependencies in cycle generator tests
- Add create_member_with_cycles helper that uses fixed 'today' date
- Update tests to use explicit 'today:' option instead of Date.utc_today()
- Prevents test failures when current date changes (e.g., in 2026+)
- Tests now explicitly delete and regenerate cycles with fixed dates
- Ensures consistent test behavior regardless of execution date
2025-12-16 16:40:11 +01:00
de7a94ab07 fix: CycleGenerator generates from last cycle, not filling gaps
- Change algorithm to start from last existing cycle instead of start_date
- Deleted cycles (gaps) are no longer automatically filled
- Add test to verify gaps remain unfilled
- Update documentation to clarify gap handling behavior
2025-12-16 16:40:11 +01:00
539084fdf1 test: make CycleGenerator tests more robust
- Replace weak assertions (>= 0, if length > 0) with concrete expectations
- Remove unnecessary Process.sleep calls (tests run synchronously)
- Add get_member_cycles helper for direct cycle verification
- Tests now validate actual generated cycles instead of relying on async behavior
2025-12-16 16:40:11 +01:00
13790dda43 feat: improve error handling in CycleGenerator
- Handle Task crashes in async_stream with {:exit, reason}
- Return {:error, {:partial_failure, successes, errors}} when some cycles fail
- Previously returned {:ok, successful} even on partial failures
- Improves debuggability and allows callers to handle partial failures
2025-12-16 16:40:11 +01:00
d01033c720 feat: include inactive members in batch cycle generation
- Remove exit_date filter from generate_cycles_for_all_members query
- Inactive members now get cycles generated up to their exit_date
- Add tests for inactive member processing and exit_date boundary
- Document exit_date == cycle_start behavior (cycle still generated)
2025-12-16 16:40:11 +01:00
78747d7da0 refactor: improve SetMembershipFeeStartDate change module
- Add warning logging for unexpected errors (not missing prerequisites)
- Use CalendarCycles.interval() type instead of generic atom()
- Update moduledoc to reflect actual usage (no where clause needed)
2025-12-16 16:40:11 +01:00
e899004b3c feat: add error logging in after_action cycle generation hooks
- Log warnings when cycle generation fails in Member create/update
- Extract generate_fn to reduce code duplication
- Improves debuggability of silent failures
2025-12-16 16:40:11 +01:00
434bcd269f refactor: use sql_sandbox config instead of env for sync/async
- Replace Application.get_env(:mv, :env) with :sql_sandbox config
- Remove redundant :env config from test.exs
- More explicit and less error-prone for test environment detection
2025-12-16 16:40:11 +01:00
25cc41b02e feat: implement automatic cycle generation for members
- Add CycleGenerator module with advisory lock mechanism
- Add SetMembershipFeeStartDate change for auto-calculation
- Extend Settings with include_joining_cycle and default_membership_fee_type_id
- Add scheduled job skeleton for future Oban integration
2025-12-16 16:40:11 +01:00
894b9b9d5c Merge pull request 'Calendar Cycle Calculation Logic closes #276' (#284) from feature/276_cycle_calculation into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #284
Reviewed-by: carla <carla@noreply.git.local-it.org>
2025-12-16 16:39:35 +01:00
a7285915e6 docs: fix CalendarCycles documentation to match actual implementation
All checks were successful
continuous-integration/drone/push Build is passing
2025-12-16 15:06:45 +01:00
da6c495d04 refactor: improve CalendarCycles API and tests based on code review 2025-12-16 15:06:45 +01:00
3fc4440bce feat: implement calendar-based cycle calculation functions
Add CalendarCycles module with functions for all interval types.
Includes comprehensive tests for edge cases.
2025-12-16 15:06:45 +01:00
0a07f4f212 Merge pull request 'Small UX fixes closes #281' (#293) from feature/281_uxfixes into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #293
2025-12-16 15:06:00 +01:00
1df1b4b238 test: use data-testids instead of regex in a11y tests
All checks were successful
continuous-integration/drone/push Build is passing
Replace regex-based aria-label assertions with data-testid-based
has_element? checks for more stable tests that are resistant to
translation changes.
2025-12-16 14:55:50 +01:00
62d04add8e fix: standardize 'Custom Field' capitalization in i18n
Change 'Save Custom field' to 'Save Custom Field' and
'Save Custom field value' to 'Save Custom Field Value' for consistency.
Update gettext files accordingly.
2025-12-16 14:54:43 +01:00
9f9d888657 test: add tests for disabled button states in member index
Add tests to verify that copy and open-email buttons are disabled
when no members are selected and enabled after selection.
Also verify that the counter shows the correct count.
2025-12-16 14:53:10 +01:00
be6ea56860 fix: improve mailto BCC encoding
Use URI.encode_www_form() instead of URI.encode() for mailto query parameters.
This is the safer choice for query parameter encoding.

Add comment about mailto URL length limits that vary by email client.
2025-12-16 14:51:42 +01:00
fb91f748c2 perf: optimize member index selection calculations
Calculate selected_count, any_selected? and mailto_bcc once in assigns
instead of recalculating Enum.any? and Enum.count multiple times in template.
This improves render performance and makes the template code more readable.
2025-12-16 14:50:52 +01:00
222af635ae fix: make disabled links more robust in CoreComponents.button
Remove navigation attributes (href, navigate, patch) when disabled=true
to prevent 'Open in new tab' and 'Copy link' from working on disabled links.
This makes the disabled state semantically stronger and independent of CSS themes.
2025-12-16 14:48:18 +01:00
dd4048669c fix: update clubname on save
All checks were successful
continuous-integration/drone/push Build is passing
2025-12-16 14:35:00 +01:00
e0712d47bc chore: change payment filter text 2025-12-16 14:35:00 +01:00
4e86351e1c feat: disable email buttons instead hide them 2025-12-16 14:35:00 +01:00
8bfa5b7d1d chore: remove immutable from custom fields 2025-12-16 14:35:00 +01:00
cb82c07cbf Merge pull request 'Membership Fee - Database Schema & Ash Domain Foundation closes #275' (#283) from feature/275_member_fee_domain into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #283
Reviewed-by: carla <carla@noreply.git.local-it.org>
2025-12-16 14:06:45 +01:00
ebbf347e42 fix(membership-fees): add DB constraints for enum and decimal precision
All checks were successful
continuous-integration/drone/push Build is passing
2025-12-11 18:46:48 +01:00