Fixed query that gets tests, when optional arguments for selecting based on state/status etc. the OR clauses needed to be collected by parens