properly comparing against StateStatus in states list template, instead of string values
moved "group states by host" logic in State model, and added a test