Skip to content
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 Enrollment Flow for consistent labeling across apps #2403

Merged
merged 20 commits into from
Oct 2, 2024

Conversation

lalver1
Copy link
Member

@lalver1 lalver1 commented Sep 25, 2024

closes #2336

What this PR does

  • This PR changes the implementation of the relationship between EnrollmentFlow and TransitAgency. EnrollmentFlow now has a TransitAgency foreign key field (many flows to one transit agency). This will allow us to have more flexibility with the names we can use in EnrollmentFlow.label (for example, having the name of the transit agency in this field won't be necessary anymore).
  • Update EnrollmentFlow labels in fixture data, to match the names used in form fields
  • Updates fixture data: Removed the digital-only and in-person only enrollment flows for now. It was breaking the Cypress tests, because these flows did not have selection labels and all the necessary HTML templates. Can be re-added when the enrollment flow filtering goes into effect.
  • Updates test failures, test fixtures. 1 failing test.
  • Update Admin view for Enrollment Flow to show Agency | Flow label | Supported methods
  • Add migration for existing data
  • Updates helptext on a flow's agency
  • EnrollmentFlow's agency is now not required and can be blank.

How to test

  • Run ./bin/reset_db.sh
  • Test both in-person and digital flows
  • Test re-ordering enrollment flows in Admin
  • Run all the tests

Screenshots

  • In Person Eligibility index: Same code, new database data
image
  • Admin: Enrollment Flows displayed with label, agency and supported methods
image

@github-actions github-actions bot added back-end Django views, sessions, middleware, models, migrations etc. migrations [auto] Review for potential model changes/needed data migrations updates deployment-dev [auto] Changes that will trigger a deploy if merged to dev and removed back-end Django views, sessions, middleware, models, migrations etc. migrations [auto] Review for potential model changes/needed data migrations updates labels Sep 25, 2024
@machikoyasuda machikoyasuda self-assigned this Sep 25, 2024
@machikoyasuda
Copy link
Member

I'll take the rest of the work of this PR - fixing tests and anything else necessary.

Copy link

github-actions bot commented Sep 26, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits/core
  admin.py
  models.py
Project Total  

This report was generated by python-coverage-comment-action

@angela-tran
Copy link
Member

@machikoyasuda Can you update the title of this PR to reflect that it covers more than just the relationship refactor? I think it is covering all of #2336

@machikoyasuda machikoyasuda changed the title Refactor: EnrollmentFlow and TransitAgency relationship Refactor: Refactor TransitAgency/EnrollmentFlow model for proper in person label form view + Admin view updates + Migration Sep 26, 2024
@machikoyasuda machikoyasuda changed the title Refactor: Refactor TransitAgency/EnrollmentFlow model for proper in person label form view + Admin view updates + Migration Refactor: Refactor TransitAgency/EnrollmentFlow model for proper in person label form view + Admin view updates + Data migration Sep 26, 2024
@machikoyasuda
Copy link
Member

@angela-tran I couldn't think of a short way to summarize all the changes into one good PR headline 😅

@machikoyasuda machikoyasuda marked this pull request as ready for review September 26, 2024 18:09
@machikoyasuda machikoyasuda requested a review from a team as a code owner September 26, 2024 18:09
@machikoyasuda machikoyasuda force-pushed the refactor/transit-agency-enrollment-flow branch from 04cda58 to 3e56fe8 Compare September 26, 2024 18:09
@angela-tran
Copy link
Member

@angela-tran I couldn't think of a short way to summarize all the changes into one good PR headline 😅

😆 It is a bit long of a title, but it does cover all the technical changes, so I think it's ok.

I guess from a more abstract level, this PR is making it so we don't need to have the transit agency name in the label, so I think another title that could work is Refactor: move transit agency name from EnrollmentFlow.label to admin UI or something like that.

Up to you, either one is fine with me!

@thekaveman
Copy link
Member

Shorter is better I think... remember this will be the commit message when the PR is merged!

@machikoyasuda machikoyasuda changed the title Refactor: Refactor TransitAgency/EnrollmentFlow model for proper in person label form view + Admin view updates + Data migration Refactor: Refactor Enrollment Flow for consistent flow labeling across apps Sep 26, 2024
@machikoyasuda machikoyasuda changed the title Refactor: Refactor Enrollment Flow for consistent flow labeling across apps Refactor Enrollment Flow for consistent flow labeling across apps Sep 26, 2024
@machikoyasuda machikoyasuda changed the title Refactor Enrollment Flow for consistent flow labeling across apps Refactor Enrollment Flow for consistent labeling across apps Sep 26, 2024
Copy link
Member

@angela-tran angela-tran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall changes look great! There are just a few code clean-ups I think we should do.

benefits/core/migrations/local_fixtures.json Outdated Show resolved Hide resolved
tests/pytest/conftest.py Outdated Show resolved Hide resolved
tests/pytest/conftest.py Outdated Show resolved Hide resolved
tests/pytest/core/test_models.py Outdated Show resolved Hide resolved
tests/pytest/core/test_models.py Outdated Show resolved Hide resolved
tests/pytest/core/test_models.py Outdated Show resolved Hide resolved
tests/pytest/core/test_views.py Outdated Show resolved Hide resolved
tests/pytest/core/test_views.py Outdated Show resolved Hide resolved
@machikoyasuda machikoyasuda force-pushed the refactor/transit-agency-enrollment-flow branch from 3e56fe8 to 4e7cdbe Compare September 27, 2024 06:10
@angela-tran
Copy link
Member

Comments for lines 351-354:

label = models.TextField(
null=True,
help_text="A human readable label, not shown to end-users. Used as the display text in Admin.",
)

Do we consider transit agency staff users as "end-users"? I'm wondering if we should remove the part that says not shown to end-users.

@machikoyasuda machikoyasuda force-pushed the refactor/transit-agency-enrollment-flow branch from 884cfb3 to f72819f Compare September 30, 2024 06:19
Copy link
Member

@angela-tran angela-tran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updates look good! Just one more change I see as needed to make sure the migration works.

benefits/core/models.py Outdated Show resolved Hide resolved
@machikoyasuda
Copy link
Member

Testing the new helptext in Admin:

image

This text makes way more sense.

@machikoyasuda machikoyasuda force-pushed the refactor/transit-agency-enrollment-flow branch from d1e2225 to 12643bb Compare September 30, 2024 23:36
@machikoyasuda machikoyasuda force-pushed the refactor/transit-agency-enrollment-flow branch from 890cd55 to ee92b87 Compare October 1, 2024 20:07
lalver1 and others added 19 commits October 1, 2024 20:37
…gency

This commit changes the implementation of the relationship between EnrollmentFlow and TransitAgency. EnrollmentFlow now has a TransitAgency foreign key field (many flows to one transit agency). This will allow us to have more flexibility with the names we can use in EnrollmentFlow.label (for example, having the name of the transit agency in this field won't be necessary anymore).
Copy link
Member

@angela-tran angela-tran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration worked, tests pass, app launches locally, admin interface shows new field / help text - looks great ✅

Thanks @machikoyasuda !

Copy link
Member

@thekaveman thekaveman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is such a great change 🤩 I love seeing our models get so clean and usable 👍

@machikoyasuda machikoyasuda merged commit 00d0009 into main Oct 2, 2024
15 checks passed
@machikoyasuda machikoyasuda deleted the refactor/transit-agency-enrollment-flow branch October 2, 2024 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment-dev [auto] Changes that will trigger a deploy if merged to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor EnrollmentFlow model so in-person eligibility view can use copy from the selection label template
4 participants