Cycle Management & Member Integration closes #279 #294

Open
moritz wants to merge 49 commits from feature/279_cycle_management into main
Showing only changes of commit f08b520e66 - Show all commits

View file

@ -76,8 +76,8 @@ defmodule Mv.Membership.MemberTypeChangeIntegrationTest do
})
|> Ash.update!()
# Wait for cycle generation
Process.sleep(100)
# Cycle generation runs synchronously in the same transaction
# No need to wait for async completion
# Create cycles: one in the past (paid), one current (unpaid)
# Note: Future cycles are not automatically generated by CycleGenerator,
@ -131,8 +131,8 @@ defmodule Mv.Membership.MemberTypeChangeIntegrationTest do
})
|> Ash.update()
# Wait for async cycle regeneration (in test it runs synchronously)
Process.sleep(100)
# Cycle regeneration runs synchronously in the same transaction
# No need to wait for async completion
# Verify past cycle is unchanged
past_cycle_after =
@ -184,8 +184,8 @@ defmodule Mv.Membership.MemberTypeChangeIntegrationTest do
})
|> Ash.update!()
# Wait for cycle generation
Process.sleep(100)
# Cycle generation runs synchronously in the same transaction
# No need to wait for async completion
# Get the current cycle and mark it as paid
current_cycle_start = CalendarCycles.calculate_cycle_start(today, :yearly)
@ -206,8 +206,8 @@ defmodule Mv.Membership.MemberTypeChangeIntegrationTest do
})
|> Ash.update()
# Wait for async cycle regeneration
Process.sleep(100)
# Cycle regeneration runs synchronously in the same transaction
# No need to wait for async completion
# Verify paid cycle is unchanged (not deleted and regenerated)
{:ok, cycle_after} = Ash.get(MembershipFeeCycle, paid_cycle.id)
@ -232,8 +232,8 @@ defmodule Mv.Membership.MemberTypeChangeIntegrationTest do
})
|> Ash.update!()
# Wait for cycle generation
Process.sleep(100)
# Cycle generation runs synchronously in the same transaction
# No need to wait for async completion
# Get the current cycle and mark it as suspended
current_cycle_start = CalendarCycles.calculate_cycle_start(today, :yearly)
@ -254,8 +254,8 @@ defmodule Mv.Membership.MemberTypeChangeIntegrationTest do
})
|> Ash.update()
# Wait for async cycle regeneration
Process.sleep(100)
# Cycle regeneration runs synchronously in the same transaction
# No need to wait for async completion
# Verify suspended cycle is unchanged (not deleted and regenerated)
{:ok, cycle_after} = Ash.get(MembershipFeeCycle, suspended_cycle.id)
@ -280,8 +280,8 @@ defmodule Mv.Membership.MemberTypeChangeIntegrationTest do
})
|> Ash.update!()
# Wait for cycle generation
Process.sleep(100)
# Cycle generation runs synchronously in the same transaction
# No need to wait for async completion
# Create cycles: one in the past (unpaid, ended), one current (unpaid, not ended)
past_cycle_start =
@ -338,8 +338,8 @@ defmodule Mv.Membership.MemberTypeChangeIntegrationTest do
})
|> Ash.update()
# Wait for async cycle regeneration
Process.sleep(100)
# Cycle regeneration runs synchronously in the same transaction
# No need to wait for async completion
# Verify past cycle is unchanged
{:ok, past_cycle_after} = Ash.get(MembershipFeeCycle, past_cycle.id)
@ -386,8 +386,8 @@ defmodule Mv.Membership.MemberTypeChangeIntegrationTest do
})
|> Ash.update!()
# Wait for cycle generation
Process.sleep(100)
# Cycle generation runs synchronously in the same transaction
# No need to wait for async completion
# Get current cycle start
current_cycle_start = CalendarCycles.calculate_cycle_start(today, :yearly)
@ -439,8 +439,8 @@ defmodule Mv.Membership.MemberTypeChangeIntegrationTest do
})
|> Ash.update()
# Wait for async cycle regeneration
Process.sleep(100)
# Cycle regeneration runs synchronously in the same transaction
# No need to wait for async completion
# Reload member with calculations
updated_member = Ash.load!(updated_member, [:current_cycle_status, :overdue_count])