Fix wrong number of bad hosts & triggers for a server

In the previous implementation "numberOfBadHosts" exists only in
each host groups, then the "numberOfBadHosts" for a server is
calculated by JavaScript side. But a host may be joined to multiple
host groups. In this case such host will be duplicated in the value.

And triggers has same problem.