Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] A process for cleaning up unpaid duplicate reservations #126

Open
offbyone opened this issue Jan 7, 2022 · 1 comment
Open

Comments

@offbyone
Copy link
Member

offbyone commented Jan 7, 2022

Need to scan periodically for unpaid duplicates. People who have difficulties with payment often have more than one reserved membership, but only one actual paid membership

@offbyone
Copy link
Member Author

offbyone commented Feb 6, 2022

This is a candidate query for those unpaid memberships:

ChicagoContact.joins({:claim=>[:user, {:reservation=>:membership}]}).
    eager_load({:claim=>[:user, {:reservation=>:membership}]}).
    merge(Reservation.uncharged).
    merge(Reservation.unpaid).
    where("memberships.name in ('adult', 'ya', 'first', 'child', 'staff', 'teen', 'supporting')")

Assuming we add to the reservation model these two scopes:

  scope :unpaid, -> { where.not(state: PAID) }
  scope :uncharged, -> {left_outer_joins(:charges).where('charges.id is null')}

I think it'll make sense to add a support view that puts these all up front and centre so that a support user can easily go through them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant