fix: improve get_last_completed_cycle and fix test helpers

- Fix get_last_completed_cycle to find most recent completed cycle
- Fix create_cycle helpers to delete auto-generated cycles first
- Fix Ash.destroy return value handling
- Fix form selectors to use specific IDs
- Fix URL parameter names for filters
- Fix Ash.read_one return value expectations in tests
This commit is contained in:
Moritz 2025-12-16 14:11:15 +01:00
parent ab7fa38010
commit 128c712dbc
Signed by: moritz
GPG key ID: 1020A035E5DD0824
12 changed files with 177 additions and 43 deletions

View file

@ -58,6 +58,14 @@ defmodule MvWeb.MemberLive.ShowMembershipFeesTest do
# Helper to create a cycle
defp create_cycle(member, fee_type, attrs) do
# Delete any auto-generated cycles first to avoid conflicts
existing_cycles =
MembershipFeeCycle
|> Ash.Query.filter(member_id == ^member.id)
|> Ash.read!()
Enum.each(existing_cycles, fn cycle -> Ash.destroy!(cycle) end)
default_attrs = %{
cycle_start: ~D[2023-01-01],
amount: Decimal.new("50.00"),