Skip to content

Commit

Permalink
fix household type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yashita-egov committed Dec 23, 2024
1 parent 373b2a7 commit 68d971b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class HouseholdLocalRepository

return HouseholdModel(
id: household.id,
householdType: household.householdType,
tenantId: household.tenantId,
clientReferenceId: household.clientReferenceId,
memberCount: household.memberCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class IndividualGlobalSearchRepository extends LocalRepository {
.equalsExp(sql.individual.clientReferenceId))
])
..where(buildAnd([
if (params.householdType == HouseholdType.community)
if (params.householdType == HouseholdType.community && params.householdClientReferenceId==null)
sql.householdMember.isHeadOfHousehold.equals(true),
sql.address.relatedClientReferenceId.isNotNull(),
sql.individual.clientReferenceId.isNotNull(),
Expand Down Expand Up @@ -284,7 +284,7 @@ class IndividualGlobalSearchRepository extends LocalRepository {
sql.projectBeneficiary.beneficiaryClientReferenceId
.equalsExp(sql.household.clientReferenceId))
]).where(buildAnd([
if (params.householdType == HouseholdType.community)
if (params.householdType == HouseholdType.community && params.householdClientReferenceId==null)
sql.householdMember.isHeadOfHousehold.equals(true),
sql.household.householdType.equalsValue(params.householdType)
]));
Expand Down
10 changes: 8 additions & 2 deletions packages/registration_delivery/lib/pages/search_beneficiary.dart
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,14 @@ class _SearchBeneficiaryPageState
? i.projectBeneficiaries
?.lastOrNull
: null,
addressModel: i.headOfHousehold!
.address!.lastOrNull!,
addressModel:
(RegistrationDeliverySingleton()
.householdType ==
HouseholdType
.community)
? i.household!.address!
: i.headOfHousehold!
.address!.lastOrNull!,
headOfHousehold:
i.headOfHousehold),
),
Expand Down
9 changes: 5 additions & 4 deletions packages/registration_delivery/lib/pages/summary_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ class SummaryPageState extends LocalizedState<SummaryPage> {
LabelValueItem(
label: localizations.translate(
i18.householdLocation.villageLabel),
value: householdState.householdModel
?.address?.locality?.code ??
localizations
.translate(i18.common.coreCommonNA),
value: localizations.translate(
householdState.householdModel?.address
?.locality?.code ??
i18.common.coreCommonNA),
isInline: true,
labelFlex: 5,
),
Expand Down Expand Up @@ -366,6 +366,7 @@ class SummaryPageState extends LocalizedState<SummaryPage> {
individualModel?.name?.givenName ??
localizations.translate(
i18.common.coreCommonNA)),
labelFlex: 5,
),
LabelValueItem(
label: localizations.translate(
Expand Down

0 comments on commit 68d971b

Please sign in to comment.