def is_bad(r):
        if settings.param.sustained_median.trigger < r.result.confidence:
            test_param = nvl(settings.param.test[literal_field(r.Talos.Test.name)], settings.param.suite[literal_field(r.Talos.Test.suite)])

            if test_param == None:
                return True

            if test_param.disable:
                return False

            if test_param.better == "higher":
                diff = -r.diff
            elif test_param.better == "lower":
                diff = r.diff
            else:
                diff = abs(r.diff)  # DEFAULT = ANY DIRECTION IS BAD

            if test_param.min_regression:
                if unicode(test_param.min_regression.strip()[-1]) == "%":
                    min_diff = Math.abs(r.past_stats.mean * float(test_param.min_regression.strip()[:-1]) / 100.0)
                else:
                    min_diff = Math.abs(float(test_param.min_regression))
            else:
                min_diff = Math.abs(r.past_stats.mean * 0.01)

            if diff > min_diff:
                return True

        return False
    def is_bad(r):
        if settings.param.sustained_median.trigger < r.result.confidence:
            test_param = settings.param.test[literal_field(r.B2G.Test.name)]

            if test_param == None:
                return True

            if test_param.better == "higher":
                diff = -r.diff
            else:
                diff = r.diff

            if unicode(test_param.min_regression.strip()[-1]) == "%":
                min_diff = Math.abs(r.past_stats.mean * float(test_param.min_regression.strip()[:-1]) / 100.0)
            else:
                min_diff = Math.abs(float(test_param.min_regression))

            if diff > min_diff:
                return True

        return False