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

Add basic auto-accept for paid registrations #10381

Closed
wants to merge 18 commits into from

Conversation

dunkOnIT
Copy link
Contributor

@dunkOnIT dunkOnIT commented Dec 7, 2024

Lots to do here, will probably just handle basic pending -> accepted case in this PR.

Implementation Thoughts

  • I'm adding an auto_accept method on the registration model. I think this should ultimately be where our auto_accept logic lives, and that is what will get called even if we have multiple entry points for auto_accepting. For example:
    • creation of a RegistrationPayment has an after_create hook that calls registration.auto_accept
    • if we want to do a BulkAutoAccept job, it can just iterate through the pending registrations in order of payment and call auto_accept on each of them

This PR

  • Add auto-accept and auto-accept-cutoff settings to competition table
  • Make them available in the competition form
  • Add tests for auto-accept functionality
  • Add tests for auto-accept cutoff
  • Hide it behind a feature flag? Or just give organizers a way to turn it off

Next PR

  • Give organizers a way to toggle auto-accept on/off
  • Give organizers a way to run a bulk auto-accept
  • Automatically run bulk auto-accept when auto-accept is toggled on
    • Warn organizers this will happen, and give them an "Are you sure?" dialogue, where saying "No" will

Later PR's

  • Auto-accept users onto waiting list when Accepted is full
    • Should they be accepted onto the waiting list if the auto-accept-cutff has been reached?
    • If so, then we should also implement a warning when an organizer tries to approve a user from the pending list while there are users in the waiting list
  • Auto-accept users from waiting list if a spot becomes available in the accepted list (ie, if an attendee's status changes away from accepted

Questions:

  • Should we default to 0 or NULL if no auto_accept_threshold is set
  • Think carefully about naming of db fields

@dunkOnIT
Copy link
Contributor Author

dunkOnIT commented Dec 8, 2024

Tests:

  • logic of when registration.auto_accept should/shouldn't allow the user to be auto-accepted
    • before registration_open
    • after registration_close
    • registration is not paid for (and all the edge cases here - donation, refunds, repayment, etc)
    • competitor limit is reached / already registered for series / newcomer limit
    • don't auto-accept from non-pending state
    • respect the enabled/disabled toggle
    • respect the disable auto-accept threshold (whether or not auto-accept is acutally disabled)
    • user who overpaid but then got refunded but then still has paid the right amount, and their status was still pending at the time of the refund? (shouldn't be possible but... idk?) unnecessary
  • check that auto_accept runs after successful payment
  • check that auto_accept doesn't run after failed payment
  • when auto-accept threshold is reached, auto_accept is toggled off actually this isn't necessary if we just compare
    • auto_accept is ONLY toggled off when the threshold is reached - not if registrations are over the threshold?

future tests:

  • auto_accept won't trigger for a pending competitor if there are competitors on the waiting list

@dunkOnIT dunkOnIT marked this pull request as ready for review December 10, 2024 22:26
@dunkOnIT dunkOnIT mentioned this pull request Dec 11, 2024
13 tasks
@dunkOnIT
Copy link
Contributor Author

Closed in favour of 10415

@dunkOnIT dunkOnIT closed this Dec 11, 2024
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

Successfully merging this pull request may close these issues.

1 participant