Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion assets
Submodule assets updated 1 files
+27 −54 openapi-schema.yaml
28 changes: 27 additions & 1 deletion eap/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class Meta:

status = fuzzy.FuzzyChoice(EAPStatus)
eap_type = fuzzy.FuzzyChoice(EAPType)
national_society_contact_name = fuzzy.FuzzyText(length=10, prefix="NS-")
national_society_contact_email = factory.LazyAttribute(lambda obj: f"{obj.national_society_contact_name.lower()}@example.com")

@factory.post_generation
def partners(self, create, extracted, **kwargs):
Expand All @@ -73,6 +75,14 @@ class Meta:
seap_lead_timeframe_unit = fuzzy.FuzzyInteger(TimeFrame.MONTHS)
seap_lead_time = fuzzy.FuzzyInteger(1, 12)
operational_timeframe = fuzzy.FuzzyInteger(1, 12)
national_society_contact_name = fuzzy.FuzzyText(length=10, prefix="NS-")
national_society_contact_email = factory.LazyAttribute(lambda obj: f"{obj.national_society_contact_name.lower()}@example.com")
ifrc_delegation_focal_point_name = fuzzy.FuzzyText(length=10, prefix="IFRC-")
ifrc_delegation_focal_point_email = factory.LazyAttribute(
lambda obj: f"{obj.ifrc_delegation_focal_point_name.lower()}@example.com"
)
ifrc_head_of_delegation_name = fuzzy.FuzzyText(length=10, prefix="ifrc-head-")
ifrc_head_of_delegation_email = factory.LazyAttribute(lambda obj: f"{obj.ifrc_head_of_delegation_name.lower()}@example.com")

@factory.post_generation
def enable_approaches(self, create, extracted, **kwargs):
Expand Down Expand Up @@ -185,11 +195,27 @@ class FullEAPFactory(factory.django.DjangoModelFactory):
class Meta:
model = FullEAP

seap_timeframe = fuzzy.FuzzyInteger(5)
expected_submission_time = fuzzy.FuzzyDateTime(datetime(2025, 1, 1, tzinfo=pytz.utc))
lead_time = fuzzy.FuzzyInteger(1, 100)
total_budget = fuzzy.FuzzyInteger(1000, 1000000)
readiness_budget = fuzzy.FuzzyInteger(1000, 1000000)
pre_positioning_budget = fuzzy.FuzzyInteger(1000, 1000000)
early_action_budget = fuzzy.FuzzyInteger(1000, 1000000)
people_targeted = fuzzy.FuzzyInteger(100, 100000)
national_society_contact_name = fuzzy.FuzzyText(length=10, prefix="NS-")
national_society_contact_email = factory.LazyAttribute(lambda obj: f"{obj.national_society_contact_name.lower()}@example.com")
ifrc_delegation_focal_point_name = fuzzy.FuzzyText(length=10, prefix="IFRC-")
ifrc_delegation_focal_point_email = factory.LazyAttribute(
lambda obj: f"{obj.ifrc_delegation_focal_point_name.lower()}@example.com"
)
ifrc_head_of_delegation_name = fuzzy.FuzzyText(length=10, prefix="ifrc-head-")
ifrc_head_of_delegation_email = factory.LazyAttribute(lambda obj: f"{obj.ifrc_head_of_delegation_name.lower()}@example.com")

@factory.post_generation
def key_actors(self, create, extracted, **kwargs):
if not create:
return

if extracted:
for actor in extracted:
self.key_actors.add(actor)
140 changes: 140 additions & 0 deletions eap/migrations/0012_remove_fulleap_seap_timeframe_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Generated by Django 4.2.26 on 2025-12-19 04:02

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("eap", "0011_alter_fulleap_updated_checklist_file_and_more"),
]

operations = [
migrations.RemoveField(
model_name="fulleap",
name="seap_timeframe",
),
migrations.RemoveField(
model_name="fulleap",
name="selection_area",
),
migrations.AlterField(
model_name="fulleap",
name="ifrc_delegation_focal_point_email",
field=models.CharField(
default="test@gmail.com",
max_length=255,
verbose_name="IFRC delegation focal point email",
),
preserve_default=False,
),
migrations.AlterField(
model_name="fulleap",
name="ifrc_delegation_focal_point_name",
field=models.CharField(
default="test",
max_length=255,
verbose_name="IFRC delegation focal point name",
),
preserve_default=False,
),
migrations.AlterField(
model_name="fulleap",
name="ifrc_head_of_delegation_email",
field=models.CharField(
default="test@gmail.com",
max_length=255,
verbose_name="IFRC head of delegation email",
),
preserve_default=False,
),
migrations.AlterField(
model_name="fulleap",
name="ifrc_head_of_delegation_name",
field=models.CharField(
default="test",
max_length=255,
verbose_name="IFRC head of delegation name",
),
preserve_default=False,
),
migrations.AlterField(
model_name="fulleap",
name="national_society_contact_email",
field=models.CharField(
default="test@gmail.com",
max_length=255,
verbose_name="national society contact email",
),
preserve_default=False,
),
migrations.AlterField(
model_name="fulleap",
name="national_society_contact_name",
field=models.CharField(
default="test",
max_length=255,
verbose_name="national society contact name",
),
preserve_default=False,
),
migrations.AlterField(
model_name="simplifiedeap",
name="ifrc_delegation_focal_point_email",
field=models.CharField(
default="test@gmail.com",
max_length=255,
verbose_name="IFRC delegation focal point email",
),
preserve_default=False,
),
migrations.AlterField(
model_name="simplifiedeap",
name="ifrc_delegation_focal_point_name",
field=models.CharField(
default="test",
max_length=255,
verbose_name="IFRC delegation focal point name",
),
preserve_default=False,
),
migrations.AlterField(
model_name="simplifiedeap",
name="ifrc_head_of_delegation_email",
field=models.CharField(
default="test@gmail.com",
max_length=255,
verbose_name="IFRC head of delegation email",
),
preserve_default=False,
),
migrations.AlterField(
model_name="simplifiedeap",
name="ifrc_head_of_delegation_name",
field=models.CharField(
default="test",
max_length=255,
verbose_name="IFRC head of delegation name",
),
preserve_default=False,
),
migrations.AlterField(
model_name="simplifiedeap",
name="national_society_contact_email",
field=models.CharField(
default="test@gmail.com",
max_length=255,
verbose_name="national society contact email",
),
preserve_default=False,
),
migrations.AlterField(
model_name="simplifiedeap",
name="national_society_contact_name",
field=models.CharField(
default="test",
max_length=255,
verbose_name="national society contact name",
),
preserve_default=False,
),
]
37 changes: 13 additions & 24 deletions eap/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,11 +749,6 @@ class CommonEAPFields(models.Model):
related_name="+",
)

seap_timeframe = models.IntegerField(
verbose_name=_("Timeframe (Years) of the EAP"),
help_text=_("Timeframe of the EAP in years."),
)

admin2 = models.ManyToManyField(
Admin2,
verbose_name=_("admin"),
Expand All @@ -768,13 +763,15 @@ class CommonEAPFields(models.Model):
# Contacts
# National Society
national_society_contact_name = models.CharField(
verbose_name=_("national society contact name"), max_length=255, null=True, blank=True
verbose_name=_("national society contact name"),
max_length=255,
)
national_society_contact_title = models.CharField(
verbose_name=_("national society contact title"), max_length=255, null=True, blank=True
)
national_society_contact_email = models.CharField(
verbose_name=_("national society contact email"), max_length=255, null=True, blank=True
verbose_name=_("national society contact email"),
max_length=255,
)
national_society_contact_phone_number = models.CharField(
verbose_name=_("national society contact phone number"), max_length=100, null=True, blank=True
Expand All @@ -787,25 +784,17 @@ class CommonEAPFields(models.Model):
partner_ns_phone_number = models.CharField(verbose_name=_("Partner NS phone number"), max_length=100, null=True, blank=True)

# Delegations
ifrc_delegation_focal_point_name = models.CharField(
verbose_name=_("IFRC delegation focal point name"), max_length=255, null=True, blank=True
)
ifrc_delegation_focal_point_email = models.CharField(
verbose_name=_("IFRC delegation focal point email"), max_length=255, null=True, blank=True
)
ifrc_delegation_focal_point_name = models.CharField(verbose_name=_("IFRC delegation focal point name"), max_length=255)
ifrc_delegation_focal_point_email = models.CharField(verbose_name=_("IFRC delegation focal point email"), max_length=255)
ifrc_delegation_focal_point_title = models.CharField(
verbose_name=_("IFRC delegation focal point title"), max_length=255, null=True, blank=True
)
ifrc_delegation_focal_point_phone_number = models.CharField(
verbose_name=_("IFRC delegation focal point phone number"), max_length=100, null=True, blank=True
)

ifrc_head_of_delegation_name = models.CharField(
verbose_name=_("IFRC head of delegation name"), max_length=255, null=True, blank=True
)
ifrc_head_of_delegation_email = models.CharField(
verbose_name=_("IFRC head of delegation email"), max_length=255, null=True, blank=True
)
ifrc_head_of_delegation_name = models.CharField(verbose_name=_("IFRC head of delegation name"), max_length=255)
ifrc_head_of_delegation_email = models.CharField(verbose_name=_("IFRC head of delegation email"), max_length=255)
ifrc_head_of_delegation_title = models.CharField(
verbose_name=_("IFRC head of delegation title"), max_length=255, null=True, blank=True
)
Expand Down Expand Up @@ -926,6 +915,11 @@ class SimplifiedEAP(EAPBaseModel, CommonEAPFields):
related_name="simplified_eap",
)

seap_timeframe = models.IntegerField(
verbose_name=_("Timeframe (Years) of the EAP"),
help_text=_("Timeframe of the EAP in years."),
)

# RISK ANALYSIS and EARLY ACTION SELECTION #

# RISK ANALYSIS #
Expand Down Expand Up @@ -1284,11 +1278,6 @@ class FullEAP(EAPBaseModel, CommonEAPFields):
blank=True,
)

selection_area = models.TextField(
verbose_name=_("Areas selection rationale"),
help_text=_("Add description for the selection of the areas."),
)

trigger_model_relevant_files = models.ManyToManyField(
EAPFile,
blank=True,
Expand Down
15 changes: 7 additions & 8 deletions eap/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class Meta:
"readiness_budget",
"pre_positioning_budget",
"early_action_budget",
"seap_timeframe",
"budget_file",
"version",
"is_locked",
Expand Down Expand Up @@ -448,8 +447,8 @@ class SimplifiedEAPSerializer(

# FILES
hazard_impact_images = EAPFileUpdateSerializer(required=False, many=True)
selected_early_actions_images = EAPFileUpdateSerializer(required=False, many=True)
risk_selected_protocols_images = EAPFileUpdateSerializer(required=False, many=True)
selected_early_actions_images = EAPFileUpdateSerializer(required=False, many=True, allow_null=True)
risk_selected_protocols_images = EAPFileUpdateSerializer(required=False, many=True, allow_null=True)

# TimeFrame
seap_lead_timeframe_unit_display = serializers.CharField(source="get_seap_lead_timeframe_unit_display", read_only=True)
Expand Down Expand Up @@ -570,11 +569,11 @@ class FullEAPSerializer(
prioritized_impacts = ImpactSerializer(many=True, required=False)

# SOURCE OF INFORMATIONS
risk_analysis_source_of_information = EAPSourceInformationSerializer(many=True, required=False)
trigger_statement_source_of_information = EAPSourceInformationSerializer(many=True, required=False)
trigger_model_source_of_information = EAPSourceInformationSerializer(many=True, required=False)
evidence_base_source_of_information = EAPSourceInformationSerializer(many=True, required=False)
activation_process_source_of_information = EAPSourceInformationSerializer(many=True, required=False)
risk_analysis_source_of_information = EAPSourceInformationSerializer(many=True, required=False, allow_null=True)
trigger_statement_source_of_information = EAPSourceInformationSerializer(many=True, required=False, allow_null=True)
trigger_model_source_of_information = EAPSourceInformationSerializer(many=True, required=False, allow_null=True)
evidence_base_source_of_information = EAPSourceInformationSerializer(many=True, required=False, allow_null=True)
activation_process_source_of_information = EAPSourceInformationSerializer(many=True, required=False, allow_null=True)

# IMAGES
hazard_selection_images = EAPFileUpdateSerializer(
Expand Down
16 changes: 14 additions & 2 deletions eap/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ def test_create_eap_registration(self):
"disaster_type": self.disaster_type.id,
"expected_submission_time": "2024-12-31",
"partners": [self.partner1.id, self.partner2.id],
"national_society_contact_name": "National society contact name",
"national_society_contact_email": "test@example.com",
}

self.authenticate(self.country_admin)
Expand Down Expand Up @@ -464,6 +466,12 @@ def test_create_simplified_eap(self):

data = {
"eap_registration": eap_registration.id,
"national_society_contact_name": "National society contact name",
"national_society_contact_email": "test@example.com",
"ifrc_delegation_focal_point_name": "IFRC delegation focal point name",
"ifrc_delegation_focal_point_email": "test_ifrc@example.com",
"ifrc_head_of_delegation_name": "IFRC head of delegation name",
"ifrc_head_of_delegation_email": "ifrc_head@example.com",
"prioritized_hazard_and_impact": "Floods with potential heavy impact.",
"risks_selected_protocols": "Protocol A and Protocol B.",
"selected_early_actions": "The early actions selected.",
Expand Down Expand Up @@ -1875,6 +1883,12 @@ def test_create_full_eap(self):

data = {
"eap_registration": eap_registration.id,
"national_society_contact_name": "National society contact name",
"national_society_contact_email": "test@example.com",
"ifrc_delegation_focal_point_name": "IFRC delegation focal point name",
"ifrc_delegation_focal_point_email": "test_ifrc@example.com",
"ifrc_head_of_delegation_name": "IFRC head of delegation name",
"ifrc_head_of_delegation_email": "ifrc_head@example.com",
"budget_file": budget_file_instance.id,
"forecast_table_file": forecast_table_file.id,
"hazard_selection_images": [
Expand Down Expand Up @@ -1918,7 +1932,6 @@ def test_create_full_eap(self):
"objective": "FUll eap objective",
"lead_time": 5,
"expected_submission_time": "2024-12-31",
"seap_timeframe": 5,
"readiness_budget": 3000,
"pre_positioning_budget": 4000,
"early_action_budget": 3000,
Expand All @@ -1945,7 +1958,6 @@ def test_create_full_eap(self):
"forecast_selection": "Rainfall forecast",
"definition_and_justification_impact_level": "Definition and justification of impact levels",
"identification_of_the_intervention_area": "Identification of the intervention areas",
"selection_area": "Selection of the area",
"early_action_selection_process": "Early action selection process",
"evidence_base": "Evidence base",
"usefulness_of_actions": "Usefulness of actions",
Expand Down
Loading