Skip to content

Commit

Permalink
chore: WIP - don't show or save flows that don't have copy
Browse files Browse the repository at this point in the history
pushing this up to get feedback. will revert / redo these changes after
getting more consensus on desired behavior.
  • Loading branch information
angela-tran committed Feb 19, 2025
1 parent 9e023bd commit 0ec5b92
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions benefits/core/models/enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def in_person_eligibility_context(self):
return eligibility[system_name].dict() if system_name in eligibility.keys() else {}

def clean(self):
template_errors = []
errors = []

if self.transit_agency:
templates = [
Expand All @@ -282,10 +282,14 @@ def clean(self):
# so just create directly for a missing template
for t in templates:
if not template_path(t):
template_errors.append(ValidationError(f"Template not found: {t}"))
errors.append(ValidationError(f"Template not found: {t}"))

if template_errors:
raise ValidationError(template_errors)
if EnrollmentMethods.IN_PERSON in self.supported_enrollment_methods:
if not self.in_person_eligibility_context:
errors.append(ValidationError(f"In-person eligibility context not found for: {self.system_name}"))

if errors:
raise ValidationError(errors)

def eligibility_form_instance(self, *args, **kwargs):
"""Return an instance of this flow's EligibilityForm, or None."""
Expand Down
2 changes: 1 addition & 1 deletion benefits/in_person/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, agency: models.TransitAgency, *args, **kwargs):

self.classes = "in-person-eligibility-form"
flow_field = self.fields["flow"]
flow_field.choices = [(f.id, f.label) for f in flows]
flow_field.choices = [(f.id, f.label) for f in flows if self.get_policy_details(f)]
flow_field.widget.attrs.update({"data-custom-validity": self.flow_field_error_message})

# dynamically add a BooleanField for each flow
Expand Down

0 comments on commit 0ec5b92

Please sign in to comment.