Skip to content

Utils

hypha.apply.determinations.utils

OUTCOME_TO_DETERMINATION module-attribute

OUTCOME_TO_DETERMINATION = {v: _Tfor (k, v) in items()}

outcome_from_actions

outcome_from_actions(actions)
Source code in hypha/apply/determinations/utils.py
def outcome_from_actions(actions):
    outcomes = [TRANSITION_DETERMINATION[action] for action in actions]
    if len(set(outcomes)) != 1:
        raise ValueError(
            "Mixed determination transitions selected - please contact an admin"
        )
    outcome = outcomes[0]
    return OUTCOME_TO_DETERMINATION[outcome]

determination_actions

determination_actions(user, submission)
Source code in hypha/apply/determinations/utils.py
def determination_actions(user, submission):
    return [action[0] for action in submission.get_actions_for_user(user)]

transition_from_outcome

transition_from_outcome(outcome, submission)
Source code in hypha/apply/determinations/utils.py
def transition_from_outcome(outcome, submission):
    for transition_name in submission.phase.transitions:
        try:
            transition_type = TRANSITION_DETERMINATION[transition_name]
        except KeyError:
            pass
        else:
            if transition_type == outcome:
                return transition_name

has_final_determination

has_final_determination(submission)
Source code in hypha/apply/determinations/utils.py
def has_final_determination(submission):
    return submission.determinations.final().exists()