Skip to content

Commit

Permalink
2235115_Remove_HH_programs_M2M (#4632)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekBiczysko authored Feb 19, 2025
1 parent b10648f commit dd221a8
Show file tree
Hide file tree
Showing 52 changed files with 164 additions and 337 deletions.
6 changes: 2 additions & 4 deletions src/frontend/data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,6 @@ type HouseholdNode implements Node {
otherSexGroupCount: Int
unknownSexGroupCount: Int
registrationDataImport: RegistrationDataImportNode
programs(offset: Int, before: String, after: String, first: Int, last: Int, name: String): ProgramNodeConnection!
returnee: Boolean
flexFields: FlexFieldsScalar
firstRegistrationDate: DateTime!
Expand All @@ -1557,7 +1556,7 @@ type HouseholdNode implements Node {
totalCashReceivedUsd: Decimal
totalCashReceived: Decimal
familyId: String
program: ProgramNode
program: ProgramNode!
copiedFrom: HouseholdNode
originUnicefId: String
isMigrationHandled: Boolean!
Expand Down Expand Up @@ -1914,7 +1913,7 @@ type IndividualNode implements Node {
walletName: String!
blockchainName: String!
walletAddress: String!
program: ProgramNode
program: ProgramNode!
copiedFrom: IndividualNode
originUnicefId: String
isMigrationHandled: Boolean!
Expand Down Expand Up @@ -2917,7 +2916,6 @@ type ProgramNode implements Node {
biometricDeduplicationEnabled: Boolean!
pduFields: [PeriodicFieldNode]
households(offset: Int, before: String, after: String, first: Int, last: Int): HouseholdNodeConnection!
householdSet(offset: Int, before: String, after: String, first: Int, last: Int): HouseholdNodeConnection!
individuals(offset: Int, before: String, after: String, first: Int, last: Int): IndividualNodeConnection!
registrationImports(offset: Int, before: String, after: String, first: Int, last: Int): RegistrationDataImportNodeConnection!
paymentSet(offset: Int, before: String, after: String, first: Int, last: Int): PaymentNodeConnection!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ export const fakeGrievanceTicketPaymentVerification = {
admin2: null,
admin3: null,
admin4: null,
programs: {
edges: [],
__typename: 'ProgramNodeConnection',
},
program: null,
totalCashReceivedUsd: null,
lastRegistrationDate: '2024-01-28T05:03:22+00:00',
start: '2024-02-16T17:11:19+00:00',
Expand Down Expand Up @@ -175,10 +172,7 @@ export const fakeGrievanceTicketPaymentVerification = {
admin2: null,
admin3: null,
admin4: null,
programs: {
edges: [],
__typename: 'ProgramNodeConnection',
},
program: null,
totalCashReceivedUsd: null,
lastRegistrationDate: '2024-01-28T05:03:22+00:00',
start: '2024-02-16T17:11:19+00:00',
Expand Down Expand Up @@ -233,10 +227,7 @@ export const fakeGrievanceTicketPaymentVerification = {
admin2: null,
admin3: null,
admin4: null,
programs: {
edges: [],
__typename: 'ProgramNodeConnection',
},
program: null,
totalCashReceivedUsd: null,
lastRegistrationDate: '2024-01-28T05:03:22+00:00',
start: '2024-02-16T17:11:19+00:00',
Expand Down Expand Up @@ -367,10 +358,7 @@ export const fakeGrievanceTicketPaymentVerification = {
admin2: null,
admin3: null,
admin4: null,
programs: {
edges: [],
__typename: 'ProgramNodeConnection',
},
program: null,
totalCashReceivedUsd: null,
lastRegistrationDate: '2024-01-28T05:03:22+00:00',
start: '2024-02-16T17:11:19+00:00',
Expand All @@ -385,10 +373,7 @@ export const fakeGrievanceTicketPaymentVerification = {
},
],
},
programs: {
edges: [],
__typename: 'ProgramNodeConnection',
},
program: null,
__typename: 'HouseholdNode',
activeIndividualsCount: 4,
countryOrigin: 'Comoros',
Expand Down
5 changes: 1 addition & 4 deletions src/frontend/fixtures/population/fakeApolloAllHouseholds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ export const fakeApolloAllHouseholds = [
totalCashReceived: null,
currency: '',
lastRegistrationDate: '2020-08-22T00:00:00',
programs: {
edges: [],
__typename: 'ProgramNodeConnection',
},
program: null,
__typename: 'HouseholdNode',
},
__typename: 'HouseholdNodeEdge',
Expand Down
36 changes: 10 additions & 26 deletions src/frontend/fixtures/population/fakeHousehold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,11 @@ export const fakeHousehold = {
status: 'ACTIVE',
admin1: null,
admin2: null,
programs: {
edges: [
{
node: {
id:
'UHJvZ3JhbU5vZGU6MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtZmFjZWIwMGMwMDAw',
name: 'Test Program',
__typename: 'ProgramNode',
},
__typename: 'ProgramNodeEdge',
},
],
__typename: 'ProgramNodeConnection',
program: {
id:
'UHJvZ3JhbU5vZGU6MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtZmFjZWIwMGMwMDAw',
name: 'Test Program',
__typename: 'ProgramNode',
},
__typename: 'HouseholdNode',
},
Expand All @@ -99,19 +91,11 @@ export const fakeHousehold = {
},
],
},
programs: {
edges: [
{
node: {
id:
'UHJvZ3JhbU5vZGU6MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtZmFjZWIwMGMwMDAw',
name: 'Test Program',
__typename: 'ProgramNode',
},
__typename: 'ProgramNodeEdge',
},
],
__typename: 'ProgramNodeConnection',
program: {
id:
'UHJvZ3JhbU5vZGU6MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtZmFjZWIwMGMwMDAw',
name: 'Test Program',
__typename: 'ProgramNode',
},
__typename: 'HouseholdNode',
activeIndividualsCount: 1,
Expand Down
16 changes: 4 additions & 12 deletions src/frontend/fixtures/population/fakeIndividual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,10 @@ export const fakeIndividual = {
pCode: 'AF1115',
__typename: 'AreaNode',
},
programs: {
edges: [
{
node: {
id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm',
name: 'Surface campaign practice actually about about will what.',
__typename: 'ProgramNode',
},
__typename: 'ProgramNodeEdge',
},
],
__typename: 'ProgramNodeConnection',
program: {
id: 'UHJvZ3JhbU5vZGU6YzRkNTY1N2QtMWEyOS00NmUxLTgxOTAtZGY3Zjg1YTBkMmVm',
name: 'Surface campaign practice actually about about will what.',
__typename: 'ProgramNode',
},
__typename: 'HouseholdNode',
address: '938 Luna Cliffs Apt. 551\nJameschester, SC 24934',
Expand Down
133 changes: 40 additions & 93 deletions src/frontend/src/__generated__/graphql.tsx

Large diffs are not rendered by default.

20 changes: 6 additions & 14 deletions src/frontend/src/apollo/fragments/HouseholdFragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,9 @@ export const householdMinimal = gql`
individuals {
totalCount
}
programs {
edges {
node {
id
name
}
}
program {
id
name
}
}
`;
Expand Down Expand Up @@ -123,13 +119,9 @@ export const householdDetailed = gql`
}
}
}
programs {
edges {
node {
id
name
}
}
program {
id
name
}
registrationDataImport {
name
Expand Down
10 changes: 3 additions & 7 deletions src/frontend/src/apollo/fragments/IndividualFragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,9 @@ export const individualMinimal = gql`
level
pCode
}
programs {
edges {
node {
id
name
}
}
program {
id
name
}
totalCashReceivedUsd
lastRegistrationDate
Expand Down
10 changes: 3 additions & 7 deletions src/frontend/src/apollo/queries/population/AllHouseholds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,9 @@ export const AllHouseholds = gql`
totalCashReceived
currency
lastRegistrationDate
programs {
edges {
node {
id
name
}
}
program {
id
name
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,9 @@ export const AllHouseholdsForPopulationTable = gql`
totalCashReceived
currency
lastRegistrationDate
programs {
edges {
node {
id
name
}
}
program {
id
name
}
program {
id
Expand Down
12 changes: 3 additions & 9 deletions src/frontend/src/apollo/queries/population/AllIndividuals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const AllIndividuals = gql`
$search: String
$documentType: String
$documentNumber: String
$programs: [ID]
$status: [String]
$lastRegistrationDate: String
$householdId: UUID
Expand All @@ -38,7 +37,6 @@ export const AllIndividuals = gql`
search: $search
documentType: $documentType
documentNumber: $documentNumber
programs: $programs
status: $status
lastRegistrationDate: $lastRegistrationDate
household_Id: $householdId
Expand Down Expand Up @@ -116,13 +114,9 @@ export const AllIndividuals = gql`
id
name
}
programs {
edges {
node {
id
name
}
}
program {
id
name
}
}
relationship
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const AllIndividualsForPopulationTable = gql`
$search: String
$documentType: String
$documentNumber: String
$programs: [ID]
$status: [String]
$lastRegistrationDate: String
$householdId: UUID
Expand Down Expand Up @@ -41,7 +40,6 @@ export const AllIndividualsForPopulationTable = gql`
search: $search
documentType: $documentType
documentNumber: $documentNumber
programs: $programs
status: $status
lastRegistrationDate: $lastRegistrationDate
household_Id: $householdId
Expand Down
1 change: 1 addition & 0 deletions src/hct_mis_api/api/endpoints/rdi/push_people.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class Meta:
"unicef_id",
"household",
"detail_id",
"program",
]


Expand Down
1 change: 1 addition & 0 deletions src/hct_mis_api/api/endpoints/rdi/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class Meta:
"version",
"vector_column",
"unicef_id",
"program",
]

def validate_role(self, value: str) -> Optional[str]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ def _generate_program_with_dependencies(options: Dict, business_area_index: int)
"registration_data_import": registration_data_import,
"business_area": business_area,
"admin_area": Area.objects.filter(area_type__business_area=business_area).order_by("?").first(),
"program": program,
},
{"registration_data_import": registration_data_import},
)
for individual in individuals:
DocumentFactory(individual=individual)

household.programs.add(program)
if household.admin_area:
program.admin_areas.add(household.admin_area)

Expand Down
2 changes: 1 addition & 1 deletion src/hct_mis_api/apps/household/admin/household.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class HouseholdAdmin(
)
search_fields = ("head_of_household__family_name", "unicef_id")
readonly_fields = ("created_at", "updated_at")
filter_horizontal = ("representatives", "programs")
filter_horizontal = ("representatives",)
raw_id_fields = (
"admin_area",
"admin1",
Expand Down
Loading

0 comments on commit dd221a8

Please sign in to comment.