Skip to content

Commit 692c0b1

Browse files
committed
Combine assignedreviewer logic in 0028 migration
1 parent 47098eb commit 692c0b1

2 files changed

Lines changed: 18 additions & 29 deletions

File tree

hypha/apply/funds/migrations/0134_change_partner_assigned_reviewers_role.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

hypha/apply/users/migrations/0028_remove_partner_group.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44
from django.contrib.auth.models import Group
55

66

7+
# An edge case that won't apply to most staystems
8+
def assigned_review_migrate_from_partners(apps, schema_editor):
9+
PARTNER_GROUP_NAME = "Partner"
10+
REVIEWER_GROUP_NAME = "Reviewer"
11+
12+
AssignedReviewers = apps.get_model("funds", "AssignedReviewers")
13+
14+
reviewer_id = Group.objects.get(name=REVIEWER_GROUP_NAME).id
15+
16+
if id_qs := Group.objects.filter(name=PARTNER_GROUP_NAME).values_list(
17+
"id", flat=True
18+
):
19+
AssignedReviewers.objects.filter(type_id=id_qs.first()).update(
20+
type_id=reviewer_id
21+
)
22+
23+
724
def migrate_partners_to_coapplicants(apps, schema_editor):
825
PARTNER_GROUP_NAME = "Partner"
926

@@ -14,7 +31,7 @@ def migrate_partners_to_coapplicants(apps, schema_editor):
1431
class Migration(migrations.Migration):
1532
dependencies = [
1633
("users", "0027_remove_drupal_id_field"),
17-
("funds", "0134_change_partner_assigned_reviewers_role"),
34+
("funds", "0133_remove_applicationsubmission_partners"),
1835
]
1936

2037
operations = [migrations.RunPython(migrate_partners_to_coapplicants)]

0 commit comments

Comments
 (0)