Skip to content

Commit

Permalink
generic-import-admin-area-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
domdinicola committed Nov 6, 2024
1 parent ce08539 commit c092b1b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "2.12.1",
"version": "2.12.3",
"private": true,
"type": "module",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion src/hct_mis_api/apps/household/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,9 @@ class CollectType(models.TextChoices):
org_name_enumerator = models.CharField(max_length=250, blank=True, default=BLANK)
village = models.CharField(max_length=250, blank=True, default=BLANK)
registration_method = models.CharField(max_length=250, choices=REGISTRATION_METHOD_CHOICES, default=BLANK)
collect_individual_data = models.CharField(max_length=250, choices=COLLECT_TYPES, default=COLLECT_TYPE_UNKNOWN)
collect_individual_data = models.CharField(
max_length=250, choices=COLLECT_TYPES, default=COLLECT_TYPE_UNKNOWN
) # TODO remove
currency = models.CharField(max_length=250, choices=CURRENCY_CHOICES, default=BLANK)
unhcr_id = models.CharField(max_length=250, blank=True, default=BLANK, db_index=True)
user_fields = JSONField(default=dict, blank=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from dateutil.relativedelta import relativedelta

from hct_mis_api.apps.household.models import (
COLLECT_TYPE_FULL,
COLLECT_TYPE_PARTIAL,
DISABLED,
FEMALE,
Expand Down Expand Up @@ -40,10 +39,7 @@ def recalculate_data(
) -> Tuple[Household, List[str]]:
household = Household.objects.select_for_update().get(id=household.id)

if (
household.collect_individual_data not in (COLLECT_TYPE_FULL, COLLECT_TYPE_PARTIAL)
and not household.program.data_collecting_type.recalculate_composition
):
if not household.program.data_collecting_type.recalculate_composition:
return household, []

individuals_to_update = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def create_individuals(
program=household.program,
first_registration_date=record.timestamp,
last_registration_date=record.timestamp,
detail_id=record.source_id,
)

record_data_dict = record.get_data()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ def test_import_data_to_datahub(
self.assertEqual(PendingIndividualRoleInHousehold.objects.filter(role=ROLE_PRIMARY).count(), 1)
self.assertEqual(PendingIndividualRoleInHousehold.objects.filter(role=ROLE_ALTERNATE).count(), 1)

self.assertEqual(pending_household.admin_area.p_code, self.household[0][admin_area_field])

def test_import_data_to_datahub_household_individual(self) -> None:
records = [
Record(
Expand Down

0 comments on commit c092b1b

Please sign in to comment.