refactor: improve cycle generation code quality and documentation
All checks were successful
continuous-integration/drone/push Build is passing
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
This commit is contained in:
parent
e6ac5d1ab1
commit
82897d5cd3
5 changed files with 53 additions and 51 deletions
|
|
@ -58,9 +58,6 @@ defmodule Mv.MembershipFees.MemberCycleIntegrationTest do
|
|||
})
|
||||
|> Ash.create!()
|
||||
|
||||
# Wait for async cycle generation
|
||||
Process.sleep(300)
|
||||
|
||||
cycles = get_member_cycles(member.id)
|
||||
|
||||
# Should have cycles for 2023 and 2024 (and possibly current year)
|
||||
|
|
@ -89,9 +86,6 @@ defmodule Mv.MembershipFees.MemberCycleIntegrationTest do
|
|||
})
|
||||
|> Ash.create!()
|
||||
|
||||
# Wait for potential async cycle generation
|
||||
Process.sleep(200)
|
||||
|
||||
cycles = get_member_cycles(member.id)
|
||||
|
||||
assert cycles == []
|
||||
|
|
@ -112,9 +106,6 @@ defmodule Mv.MembershipFees.MemberCycleIntegrationTest do
|
|||
})
|
||||
|> Ash.create!()
|
||||
|
||||
# Wait for potential async cycle generation
|
||||
Process.sleep(200)
|
||||
|
||||
cycles = get_member_cycles(member.id)
|
||||
|
||||
assert cycles == []
|
||||
|
|
@ -145,9 +136,6 @@ defmodule Mv.MembershipFees.MemberCycleIntegrationTest do
|
|||
|> Ash.Changeset.for_update(:update_member, %{membership_fee_type_id: fee_type.id})
|
||||
|> Ash.update!()
|
||||
|
||||
# Wait for async cycle generation
|
||||
Process.sleep(300)
|
||||
|
||||
cycles = get_member_cycles(member.id)
|
||||
|
||||
# Should have generated cycles
|
||||
|
|
@ -178,9 +166,6 @@ defmodule Mv.MembershipFees.MemberCycleIntegrationTest do
|
|||
|
||||
members = Enum.map(tasks, &Task.await/1)
|
||||
|
||||
# Wait for all async cycle generations
|
||||
Process.sleep(500)
|
||||
|
||||
# Each member should have cycles
|
||||
Enum.each(members, fn member ->
|
||||
cycles = get_member_cycles(member.id)
|
||||
|
|
@ -205,9 +190,6 @@ defmodule Mv.MembershipFees.MemberCycleIntegrationTest do
|
|||
})
|
||||
|> Ash.create!()
|
||||
|
||||
# Wait for async cycle generation
|
||||
Process.sleep(300)
|
||||
|
||||
initial_cycles = get_member_cycles(member.id)
|
||||
initial_count = length(initial_cycles)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue