evolution-events / Artaxerxes

Evolution Events information system
http://www.evolution-events.nl
4 stars 0 forks source link

Limit registration status changes in admin? #69

Open matthijskooijman opened 5 years ago

matthijskooijman commented 5 years ago

Currently, registration status can simply be edited through the admin. However, when you manually set a registration to REGISTERED, you bypass the waitinglist logic, which might cause the full fields of options to remain unset. You could also accidentally make someone REGISTERED, even when there is no room (though that might be intentional or temporary, so perhaps that should be allowed).

Also, not all state transitions make sense, so maybe some of these should be limited?

This relates to #67.

matthijskooijman commented 5 years ago

This equally applies to changing registration options, since those might also influence the availability of slots or the waitinglist status of the registration.

ReneB commented 5 years ago

Well, "setting a status" is always a bit tricky since none of the application logic applies. I could imagine some kind of state machine logic that could determine "possible states to transfer to" and adding buttons to the form for those states - such as "Register" instead of "Set status to registered", with a possible override option or something. There may still be a requirement for setting the status, but that should be a more explicit action, I think, since it can mess stuff up (and this has happened in the past to our events as well, so it's not an unrealistic scenario).

matthijskooijman commented 5 years ago

WIP comment, out of time for now, will edit to become complete later.

It might be interesting to explore the possible state changes and see which make (no) sense and also what additional work needs to happen. We have the following states:

PREPARATION_IN_PROGRESS
PREPARATION_COMPLETE
REGISTERED
WAITINGLIST
CANCELLED

... Unfinished

matthijskooijman commented 4 years ago

Before finishing the previous comment, maybe a more interesting angle is thinking about:

As for those preconditions, I'm thinking of:

matthijskooijman commented 3 years ago

One other related issue is that of when to remove medical and address details. In particular, setting the status of a registration to cancelled could mean that these need to be removed. I'm thinking it would be good to make this explicit in the admin (e.g. similar to when you delete an object in the admin, it asks for confirmation showing all the cascaded deletes that will happen), but doing such confirmation is probably easier when status changes are done using admin "actions", rather than just changing the status dropdown directly (though an added complication is that deleting a registration can also cause userdata to be removed, but this is quite hard to model in Django's cascading delete system, especially when deleting multiple objects, since userdata must be delete when the last active registration that needs it is removed. Maybe something with bulk_related_objects could be done, or a fake one_to_one or one_to_many (that's all that django.db.models.deletion.Collector considers) with a custom on_delete handler.