fixes #505

As mentioned in my previous pull request, this is an extension of the work done there to make it so when we unset a group badge, it keeps the same "registered" date, which matters because of the price bump.
I'm also trying to add and update unit tests as I go, especially for things that already have unit tests like the ``assign_badges`` function.