Ejemplo n.º 1
0
def _conditional_expression(spec):
    wrapped = ConditionalExpressionSpec.wrap(spec)
    return ConditionalExpression(
        FilterFactory.from_spec(wrapped.test),
        ExpressionFactory.from_spec(wrapped.expression_if_true),
        ExpressionFactory.from_spec(wrapped.expression_if_false),
    )
Ejemplo n.º 2
0
def _conditional_expression(spec, context):
    wrapped = ConditionalExpressionSpec.wrap(spec)
    wrapped.configure(
        _make_filter(wrapped.test, context),
        ExpressionFactory.from_spec(wrapped.expression_if_true, context),
        ExpressionFactory.from_spec(wrapped.expression_if_false, context),
    )
    return wrapped
Ejemplo n.º 3
0
def _conditional_expression(spec, context):
    wrapped = ConditionalExpressionSpec.wrap(spec)
    wrapped.configure(
        _make_filter(wrapped.test, context),
        ExpressionFactory.from_spec(wrapped.expression_if_true, context),
        ExpressionFactory.from_spec(wrapped.expression_if_false, context),
    )
    return wrapped
Ejemplo n.º 4
0
def _conditional_expression(spec):
    # no way around this since the two factories inherently depend on each other
    from corehq.apps.userreports.filters.factory import FilterFactory
    wrapped = ConditionalExpressionSpec.wrap(spec)
    return ConditionalExpression(
        FilterFactory.from_spec(wrapped.test),
        ExpressionFactory.from_spec(wrapped.expression_if_true),
        ExpressionFactory.from_spec(wrapped.expression_if_false),
    )