Skip to content

Commit

Permalink
Merge pull request #4165 from unicef/migration-for-pdu-subtype-boolea…
Browse files Browse the repository at this point in the history
…n-into-bool

Migrate PDU subtype: BOOLEAN -> BOOL
  • Loading branch information
pkujawa authored Aug 27, 2024
2 parents ac63d76 + 7c2ae87 commit c627b47
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
15 changes: 15 additions & 0 deletions backend/hct_mis_api/apps/core/migrations/0086_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.db import migrations

def migrate_subtype_boolean_to_bool(apps, schema_editor):
PeriodicFieldData = apps.get_model('core', 'PeriodicFieldData')
PeriodicFieldData.objects.filter(subtype='BOOLEAN').update(subtype='BOOL')

class Migration(migrations.Migration):

dependencies = [
('core', '0085_migration'),
]

operations = [
migrations.RunPython(migrate_subtype_boolean_to_bool, reverse_code=migrations.RunPython.noop),
]
10 changes: 8 additions & 2 deletions backend/selenium_tests/targeting/test_targeting.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,14 @@ def test_create_targeting_with_pdu_decimal_criteria(
pageTargetingDetails.getLockButton()

assert pageTargetingDetails.getCriteriaContainer().text == bool_no_expected_criteria_text
assert pageTargetingDetails.getHouseholdTableCell(1, 1).text == individual1.household.unicef_id
assert pageTargetingDetails.getHouseholdTableCell(2, 1).text == individual2.household.unicef_id
assert pageTargetingDetails.getHouseholdTableCell(1, 1).text in [
individual1.household.unicef_id,
individual2.household.unicef_id,
]
assert pageTargetingDetails.getHouseholdTableCell(2, 1).text in [
individual1.household.unicef_id,
individual2.household.unicef_id,
]
assert pageTargetingCreate.getTotalNumberOfHouseholdsCount().text == "2"
assert len(pageTargetingDetails.getHouseholdTableRows()) == 2

Expand Down

0 comments on commit c627b47

Please sign in to comment.