-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: move EligibilityType fields to EnrollmentFlow (#2299)
- Loading branch information
Showing
22 changed files
with
421 additions
and
603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
benefits/core/migrations/0022_refactor_EligibilityType_EnrollmentFlow.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Generated by Django 5.0.6 on 2024-08-14 16:14 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def migrate_data(apps, schema_editor): | ||
EnrollmentFlow = apps.get_model("core", "EnrollmentFlow") | ||
|
||
for flow in EnrollmentFlow.objects.all(): | ||
if flow.eligibility_type is not None: | ||
flow.name = flow.eligibility_type.name | ||
flow.label = flow.eligibility_type.label | ||
flow.group_id = flow.eligibility_type.group_id | ||
flow.supports_expiration = flow.eligibility_type.supports_expiration | ||
flow.expiration_days = flow.eligibility_type.expiration_days | ||
flow.expiration_reenrollment_days = flow.eligibility_type.expiration_reenrollment_days | ||
flow.enrollment_index_template = flow.eligibility_type.enrollment_index_template | ||
flow.enrollment_error_template = flow.eligibility_type.reenrollment_error_template | ||
flow.enrollment_success_template = flow.eligibility_type.enrollment_success_template | ||
flow.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("core", "0021_rename_eligibilityverifier_enrollmentflow"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="enrollmentflow", | ||
name="enrollment_index_template", | ||
field=models.TextField( | ||
default="enrollment/index.html", | ||
help_text="Template for the Eligibility Confirmation page (which is the index of the enrollment Django app)", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="enrollmentflow", | ||
name="enrollment_success_template", | ||
field=models.TextField( | ||
default="enrollment/success.html", | ||
help_text="Template for a successful enrollment associated with the enrollment flow", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="enrollmentflow", | ||
name="expiration_days", | ||
field=models.PositiveSmallIntegerField( | ||
blank=True, | ||
null=True, | ||
help_text="If the enrollment supports expiration, number of days before the eligibility expires", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="enrollmentflow", | ||
name="expiration_reenrollment_days", | ||
field=models.PositiveSmallIntegerField( | ||
blank=True, | ||
null=True, | ||
help_text="If the enrollment supports expiration, number of days preceding the expiration date during which a user can re-enroll in the eligibilty", # noqa: E501 | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="enrollmentflow", | ||
name="group_id", | ||
field=models.TextField(null=True, help_text="Reference to the TransitProcessor group for user enrollment"), | ||
), | ||
migrations.AddField( | ||
model_name="enrollmentflow", | ||
name="label", | ||
field=models.TextField( | ||
null=True, help_text="A human readable label, not shown to end-users. Used as the display text in Admin." | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="enrollmentflow", | ||
name="reenrollment_error_template", | ||
field=models.TextField( | ||
blank=True, null=True, help_text="Template for a re-enrollment error associated with the enrollment flow" | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="enrollmentflow", | ||
name="supports_expiration", | ||
field=models.BooleanField(default=False, help_text="Indicates if the enrollment expires or does not expire"), | ||
), | ||
migrations.RunPython(migrate_data), | ||
migrations.RenameField( | ||
model_name="enrollmentflow", | ||
old_name="name", | ||
new_name="system_name", | ||
), | ||
migrations.RemoveField( | ||
model_name="enrollmentflow", | ||
name="eligibility_type", | ||
), | ||
migrations.RemoveField( | ||
model_name="transitagency", | ||
name="eligibility_types", | ||
), | ||
migrations.DeleteModel( | ||
name="EligibilityType", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.