magfest/ubersystem — pull request #522 by EliAndrewC (2014-09-07 23:16:25+00:00)
Title: fixes #444: group deletion now works and several other problems have been fixed

So there were basically three problems being fixed, which I'll list in decreasing order of severity.

1) SQLAlchemy has pre-flush and post-flush hooks, and I was under the impression from reading their somewhat confusingly worded documentation that if the pre-flush event happened, then the post-flush event would always happen. It turns out that if an exception is raised, then the post-flush doesn't happen. So this caused us to acquire the ``BADGE_LOCK`` and then never release it, which is why Uber was freezing up. I fixed this by adding another event, which *is* called anytime these errors happen.

2) The exception shouldn't have been happening in the first place, but happened when someone tried to delete a group leader. This is no longer possible, since we'll now display an error.

3) Groups used to force you to unassign and delete all assigned badges individually, to avoid causing problems, like what if a volunteer is in the group. However, this is very inconvenient, so instead I'm adding a separate confirmation page that will let us delete an entire group all at once, with a warning about how we should only do it if we're sure it's okay, and listing all the assigned badges being deleted.