Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove TargetPopulation and HouseholdSelection models #4581

Merged
merged 56 commits into from
Feb 13, 2025
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c3dc83d
remove TP i HS
pavlo-mk Jan 20, 2025
c9a6fef
Merge branch 'develop' into remove_models_tp
pavlo-mk Jan 20, 2025
a332a97
fix tests & fixes
pavlo-mk Jan 21, 2025
27a3563
fix more unit tests
pavlo-mk Jan 21, 2025
83b62b0
tests
pavlo-mk Jan 22, 2025
052531a
clean up
pavlo-mk Jan 22, 2025
30ff090
fix
pavlo-mk Jan 22, 2025
351dec8
fixes again
pavlo-mk Jan 22, 2025
bc7836a
Merge branch 'develop' into remove_models_tp
pavlo-mk Jan 22, 2025
263c783
upd filters
pavlo-mk Jan 23, 2025
7560d95
Merge branch 'develop' into remove_models_tp
pavlo-mk Jan 23, 2025
cc3b9d7
upd test
pavlo-mk Jan 23, 2025
14f1a4e
small fixes & add more unit tests
pavlo-mk Jan 23, 2025
e6d7e4e
generate schema, remove old properties from queries
Jan 23, 2025
8102df7
pragma no cover
pavlo-mk Jan 23, 2025
c10209c
more adjustments
Jan 23, 2025
ce56184
add filter_by_household_id
pavlo-mk Jan 24, 2025
07c8c7d
coverage & set PP.targeting_criteria not nullable
pavlo-mk Jan 24, 2025
e0ecd96
upd migrations
pavlo-mk Jan 24, 2025
78a6d70
upd tests
pavlo-mk Jan 24, 2025
464e961
upd schema
pavlo-mk Jan 24, 2025
b6deb35
more changes
Jan 24, 2025
4b1da65
fix tests
Jan 24, 2025
326078c
temp fix
pavlo-mk Jan 24, 2025
638a254
add status filtering to payment verification page
Jan 27, 2025
551d2fd
Merge branch 'develop' into remove_models_tp
mmaciekk Jan 27, 2025
2e33c07
fix snapshot
Jan 27, 2025
c32a014
fix status in test_payment_verification
Jan 27, 2025
82599ce
upd filter
pavlo-mk Jan 27, 2025
37d5ca6
fix filter & upd tests
pavlo-mk Jan 27, 2025
0772f76
remove arr in arr verificationStatus
Jan 27, 2025
f6799db
fix PV page, PP plan page displays
Jan 27, 2025
f6b845b
upd unit test
pavlo-mk Jan 28, 2025
ebb8e3e
Merge branch 'develop' into remove_models_tp
pavlo-mk Jan 28, 2025
73b9e1c
test one more time
pavlo-mk Jan 28, 2025
cf90653
migration & conflicts
pavlo-mk Jan 31, 2025
54849d6
conflicts
pavlo-mk Jan 31, 2025
4477182
remove empy files
pavlo-mk Jan 31, 2025
7228b06
test
pavlo-mk Jan 31, 2025
3a3cc42
test unit
pavlo-mk Jan 31, 2025
82cbc29
more ut
pavlo-mk Jan 31, 2025
22aef92
upd tests
pavlo-mk Jan 31, 2025
033eb01
upd tests
pavlo-mk Jan 31, 2025
1fde0cc
upd tests
pavlo-mk Jan 31, 2025
30ce4c6
pragma added
pavlo-mk Jan 31, 2025
e22a697
comment
pavlo-mk Jan 31, 2025
268faef
upd coverage
pavlo-mk Jan 31, 2025
0776455
Merge branch 'develop' into remove_models_tp
pavlo-mk Jan 31, 2025
1def4de
Merge branch 'develop' into remove_models_tp
pavlo-mk Feb 10, 2025
63d5396
merge develop
pavlo-mk Feb 11, 2025
74361aa
fix snapshot
Feb 11, 2025
85a9b59
Merge branch 'develop' into remove_models_tp
pavlo-mk Feb 12, 2025
c65f9f8
conflicts
pavlo-mk Feb 13, 2025
fee5cc9
review
pavlo-mk Feb 13, 2025
02a2f2c
merge develop
pavlo-mk Feb 13, 2025
67e685b
fix filters & upd utests
pavlo-mk Feb 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tests
pavlo-mk committed Jan 22, 2025
commit 83b62b0dc0d870215269f1accf429e5a4bf68c9c
1 change: 0 additions & 1 deletion src/hct_mis_api/apps/accountability/fixtures.py
Original file line number Diff line number Diff line change
@@ -62,7 +62,6 @@ class Meta:
title = factory.Faker("sentence", nb_words=2, variable_nb_words=True, ext_word_list=None)
category = factory.fuzzy.FuzzyChoice(Survey.CATEGORY_CHOICES, getter=lambda c: c[0])
created_by = factory.SubFactory(UserFactory)
target_population = None
payment_plan = None
program = None
business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first())
1 change: 0 additions & 1 deletion src/hct_mis_api/apps/payment/models/payment.py
Original file line number Diff line number Diff line change
@@ -688,7 +688,6 @@ def household_list(self) -> "QuerySet":
"""copied from TP
used in:
1) create PP.create_payments() all list just filter by targeting_criteria, PaymentPlan.Status.TP_OPEN
2)
"""
all_households = Household.objects.filter(business_area=self.business_area, program=self.program_cycle.program)
households = all_households.filter(self.targeting_criteria.get_query()).order_by("unicef_id")
12 changes: 9 additions & 3 deletions src/hct_mis_api/apps/targeting/migrations/0003_migration.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Generated by Django 3.2.25 on 2025-01-20 14:56
# Generated by Django 3.2.25 on 2025-01-22 08:43

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('payment', '0013_migration'),
('accountability', '0006_migration'),
('targeting', '0002_migration'),
]

@@ -52,6 +50,14 @@ class Migration(migrations.Migration):
model_name='targetpopulation',
name='targeting_criteria',
),
migrations.RemoveField(
model_name='targetingcriteria',
name='household_ids',
),
migrations.RemoveField(
model_name='targetingcriteria',
name='individual_ids',
),
migrations.DeleteModel(
name='HouseholdSelection',
),
16 changes: 0 additions & 16 deletions src/hct_mis_api/apps/targeting/models.py
Original file line number Diff line number Diff line change
@@ -48,10 +48,6 @@ class TargetingCriteria(TimeStampedUUIDModel, TargetingCriteriaQueryingBase):
default=False,
help_text=_("Exclude households with individuals (members or collectors) on sanction list."),
)
# TODO: deprecated already moved to 'TargetingCriteriaRule'
household_ids = models.TextField(blank=True)
# TODO: deprecated already moved to 'TargetingCriteriaRule'
individual_ids = models.TextField(blank=True)

def get_rules(self) -> "QuerySet":
return self.rules.all()
@@ -65,18 +61,6 @@ def get_query(self) -> Q:
query = super().get_query()
if self.payment_plan.status != PaymentPlan.Status.TP_OPEN:
query &= Q(size__gt=0)

q_hh_ids = Q(unicef_id__in=self.household_ids.split(", "))
q_ind_ids = Q(individuals__unicef_id__in=self.individual_ids.split(", "))

if self.household_ids and self.individual_ids:
query &= Q(q_hh_ids | q_ind_ids)
return query

if self.household_ids:
query &= q_hh_ids
if self.individual_ids:
query &= q_ind_ids
return query


Loading