Skip to content

Commit

Permalink
individual global search to show all total members
Browse files Browse the repository at this point in the history
  • Loading branch information
yashita-egov committed Dec 5, 2024
1 parent f551013 commit c36c17c
Showing 1 changed file with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,19 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc {
),
);

var finalHouseholdMembersList = await fetchHouseholdMembersBulk(
null, householdList.map((e) => e.clientReferenceId).toList());

individualsList = await individual.search(IndividualSearchModel(
clientReferenceId: finalHouseholdMembersList
.map((e) => e.individualClientReferenceId!)
.toList()));

projectBeneficiariesList = await projectBeneficiary.search(
ProjectBeneficiarySearchModel(
projectId: [RegistrationDeliverySingleton().projectId.toString()],
beneficiaryClientReferenceId:
individualClientReferenceIds.map((e) => e).toList()));
individualsList.map((e) => e.clientReferenceId).toList()));

List<dynamic> tasksRelated = await _processTasksAndRelatedData(
projectBeneficiariesList, taskList, sideEffectsList, referralsList);
Expand All @@ -109,7 +117,7 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc {
referralsList = tasksRelated[2];

await _processHouseholdEntries(
householdMembers,
finalHouseholdMembersList,
householdList,
individualsList,
projectBeneficiariesList,
Expand Down Expand Up @@ -160,6 +168,20 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc {
clientReferenceId: houseHoldClientReferenceIds,
));

var finalHouseholdMembersList = await fetchHouseholdMembersBulk(
null, householdList.map((e) => e.clientReferenceId).toList());

individualsList = await individual.search(IndividualSearchModel(
clientReferenceId: finalHouseholdMembersList
.map((e) => e.individualClientReferenceId!)
.toList()));

projectBeneficiariesList = await projectBeneficiary.search(
ProjectBeneficiarySearchModel(
projectId: [RegistrationDeliverySingleton().projectId.toString()],
beneficiaryClientReferenceId:
individualsList.map((e) => e.clientReferenceId).toList()));

finalResults.forEach((element) {
taskList.add(element);
});
Expand All @@ -173,7 +195,7 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc {

// Process household entries and add to containers
await _processHouseholdEntries(
householdMembersList,
finalHouseholdMembersList,
householdList,
individualsList,
projectBeneficiariesList,
Expand Down Expand Up @@ -206,11 +228,19 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc {
.toList(),
));

var finalHouseholdMembersList = await fetchHouseholdMembersBulk(
null, householdList.map((e) => e.clientReferenceId).toList());

individualsList = await individual.search(IndividualSearchModel(
clientReferenceId: finalHouseholdMembersList
.map((e) => e.individualClientReferenceId!)
.toList()));

projectBeneficiariesList = await projectBeneficiary.search(
ProjectBeneficiarySearchModel(
projectId: [RegistrationDeliverySingleton().projectId.toString()],
beneficiaryClientReferenceId:
individualClientReferenceIds.map((e) => e).toList()));
individualsList.map((e) => e.clientReferenceId).toList()));

List<dynamic> tasksRelated = await _processTasksAndRelatedData(
projectBeneficiariesList, taskList, sideEffectsList, referralsList);
Expand All @@ -220,7 +250,7 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc {
referralsList = tasksRelated[2];

await _processHouseholdEntries(
householdMembers,
finalHouseholdMembersList,
householdList,
individualsList,
projectBeneficiariesList,
Expand Down

0 comments on commit c36c17c

Please sign in to comment.