Skip to content

Utils

hypha.apply.api.v1.determination.utils

get_fields_for_stage

get_fields_for_stage(submission)
Source code in hypha/apply/api/v1/determination/utils.py
def get_fields_for_stage(submission):
    forms = submission.get_from_parent("determination_forms").all()
    index = submission.workflow.stages.index(submission.stage)
    try:
        return forms[index].form.form_fields
    except IndexError:
        return forms[0].form.form_fields

outcome_choices_for_phase

outcome_choices_for_phase(submission, user)

Outcome choices correspond to Phase transitions. We need to filter out non-matching choices. i.e. a transition to In Review is not a determination, while Needs more info or Rejected are.

Source code in hypha/apply/api/v1/determination/utils.py
def outcome_choices_for_phase(submission, user):
    """
    Outcome choices correspond to Phase transitions.
    We need to filter out non-matching choices.
    i.e. a transition to In Review is not a determination, while Needs more info or Rejected are.
    """
    available_choices = [("", _("-- No determination selected -- "))]
    choices = dict(DETERMINATION_CHOICES)
    for transition_name in determination_actions(user, submission):
        try:
            determination_type = TRANSITION_DETERMINATION[transition_name]
        except KeyError:
            pass
        else:
            available_choices.append((determination_type, choices[determination_type]))
    return available_choices