assign groups: handle special case when a student changed batch, so it should still be visible in the groups of the previous batch