Okay so this is my interpretation of what you are seeing/asking
The user clicks a button
A series of if- statements will decide what badges to assign
The problem: Your if- statements are not working correctly so the badge assignment is incorrect
What the issue looks like to me:
Your if statements are disconnected, you need if/else or switch/case if you want them to be evaluated in connection to one another
If(criteria1){
//do something
else if (criteria 2) {
//do something else
}
Let me know if that interpretation seems correct.