-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: field defaults, optional fields, templates #2471
base: main
Are you sure you want to change the base?
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
c14e109
to
8d1cd32
Compare
a088943
to
54b2042
Compare
56165d4
to
6012bff
Compare
321538f
to
7759cc7
Compare
6f4337f
to
e255665
Compare
5973f31
to
ab9b8c4
Compare
9abea1b
to
6bed021
Compare
e73e3df
to
b413ddc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested running through these flows and they all looked good:
- Medicare ✅
- Older Adult ✅
- Calfresh ✅
- Veteran ✅
- Agency Card ✅
These admin panel actions also behaved as expected:
- New
TransitAgency
instances can be created with only the slug field provided ✅ - Saving an active
TransitAgency
requires certain info fields to have values ✅ - Saving an active
TransitAgency
requires templates to exist (and the defaults are calculated from theslug
) ✅ - Saving an
EnrollmentFlow
with an activeTransitAgency
requires templates to exist, and defaults are calculated from thesystem_name
orTransitAgency.slug
✅
At first I was a bit confused about action 4 above, because to review I created a new EnrollmentFlow
without claims information for an active agency and so what I got in the eligibility form was another Agency Cardholder
radio input identical to the existing one. But this is completely normal and basically shows that for a case like this, overriding the selection label template would be needed.
Hmmm... this seems like it should be an error. I.e. we should have either claims information or Eligibility API information on the flow for an active agency. Seems like this is something we should check for in the |
Yep, now that I look at it again, I feel it should be an error. I think that if we add something like if self.claims_provider and not bool(self.claims_scope):
errors.update(claims_scope=ValidationError("Missing scope"))
if self.claims_provider and not bool(self.claims_eligibility_claim):
errors.update(claims_eligibility_claim=ValidationError("Missing eligibility claim")) to if errors:
raise ValidationError(errors) then the form will give a validation error if a I think a similar check should happen if it is an Eligibility API flow. Currently if |
slug field is a SlugField for validation
- compute template fields by default - allow overriding templates
- compute some template fields by default - allow overriding templates
further simplify template requirements for flows rename agency card templates into standard naming pattern: {prefix}--{agency.slug}--agency-card.html where {prefix} is e.g. eligibility/start or enrollment/success
- use CST defaults for user-facing fields - allow blanks for config fields - remove null from TextField, not needed when blank=True
when active=True, validate that: - there are values for user-facing info fields like names, logos, phone, etc. - templates exist
when the flow's agency.active=True, validate that templates exist consolidate other EnrollmentFlow.clean() tests
change default to empty string these are stored as the empty string when blank=True Django recommends against null=True on TextFields: https://docs.djangoproject.com/en/5.1/ref/models/fields/#null
keep track of all field and template errors separately raise a ValidationError from either when present
b413ddc
to
ca8ef7d
Compare
this field is now captured on EnrollmentFlow with the other Eligibility API fields
This PR is another step along the way of making it easier and faster to configure new
TransitAgency
andEnrollmentFlow
instances, while also ensuring a valid configuration for instances that are going live on the app.Changes
TransitAgency
slug
field a DjangoSlugField
to enforce the slugness; this field is now used to calculate template paths as welllong_name
,phone
from CST defaultsslug
following our established pattern, e.g.core/index--{slug}.html
andeligibility/index--{slug}.html
active=True
validates some fields (e.g. info fields, templates must exist)EnrollmentFlow
system_name
field a DjangoSlugField
to enforce slugness; this field is now used to calculate template paths as wellsystem_name
orslug
following our established pattern, e.g.eligibility/start--{system_name}.html
andenrollment/success--{slug}.html
courtesy-card
eligibility/start--{slug}-agency-card.html
EnrollmentFlow
has an activeTransitAgency
, validates that templates exist and that either claims verification or Eligibility API verification is configured correctly.Reviewing
bin/reset_db.sh
with default fixturesTransitAgency
instances can be created with only theslug
field providedTransitAgency
requires certain info fields to have valuesTransitAgency
requires templates to exist, and the defaults are calculated from theslug
)EnrollmentFlow
with an activeTransitAgency
requires a valid claims or Eligibility API verification configurationEnrollmentFlow
with an activeTransitAgency
requires templates to exist, and defaults are calculated from thesystem_name
orTransitAgency.slug
.