Solving bug calculating badges (iii)