Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

StateManager conditional states need labels and priority over the main state #165

Closed
3 tasks done
jace opened this issue Feb 7, 2018 · 1 comment
Closed
3 tasks done

Comments

@jace
Copy link
Member

jace commented Feb 7, 2018

In Funnel, we have a conditional state named SCHEDULED which builds on the CONFIRMED state and confirms a linked session in the schedule.

SCHEDULED takes precedence over CONFIRMED in the UI. A proposal that is scheduled should be listed as such and not as merely confirmed. This requires three changes:

  1. Conditional states need labels, similar to the labels inherited from the LabeledEnum (including NameTuple support). add_conditional_state needs to accept a label parameter.

  2. proposal.state.label (in Funnel) should return the conditional state's label instead of the main state's. To achieve this, conditional states should have a priority field, should be pre-sorted by priority, and should be tested in order of priority to find the first match. Main states have a priority of 0 and conditional states should get max+1 unless manually specified. This will allow more than one conditional state to exist on the same main state.

  3. Sometimes we'll want a UI construct like this: {% if proposal.state.SCHEDULED %}{{ proposal.state.SCHEDULED.label %}{% endif %}. This can't work because state.NAME is a boolean. What if it is a ManagedStateWrapper instead, which in turn implements __nonzero__/__bool__? The if condition will continue to work then.

jace added a commit that referenced this issue Feb 7, 2018
This breaks one test, but that test is for an internal object
jace added a commit that referenced this issue Feb 7, 2018
jace added a commit that referenced this issue Feb 7, 2018
@jace
Copy link
Member Author

jace commented Feb 7, 2018

We don't need a priority field if we just use definition order and make later definitions higher priority (so conditional states defined after the main state also take higher priority).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant