coaster icon indicating copy to clipboard operation
coaster copied to clipboard

StateManagerWrapper.group() doesn't include conditional states

Open iambibhas opened this issue 5 years ago • 2 comments

Ideally it should.

iambibhas avatar Mar 19 '19 16:03 iambibhas

IMO, group should accept a list of desired states and test each item against that state. That way states defined in the model don't leak into UI when they're only meant for backend use.

Perhaps you can do this in Funnel as a one-off solution? There is no way to refer to a state object at the moment as Model.state.STATE will return a SQL expression (#181), so it's unclear how group will accept state as a parameter.

Cheap hack you could use for now:

buckets = {}
for proposal in proposal_list:
    for state in ['A', 'B', ...]:
        if getattr(proposal.state, state):
            buckets.setdefault(state, []).append (proposal)

jace avatar Mar 20 '19 12:03 jace

This issue is blocked on #181.

jace avatar Jul 29 '19 15:07 jace