Skip to content

Commit 32a928d

Browse files
Merge pull request #1603 from IFRCGo/develop
Country Plan - strategic priority
2 parents ef43eec + 75ce999 commit 32a928d

17 files changed

+189
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## Unreleased
88

9+
## 1.1.462
10+
11+
### Added
12+
- Country Plans – strategic priorities
13+
- Adding IDN, MYS, PHL, POL to Admin2 areas
14+
915
## 1.1.461
1016

1117
### Added
@@ -2099,7 +2105,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
20992105

21002106
## 0.1.20
21012107

2102-
[Unreleased]: https://github.com/IFRCGo/go-api/compare/1.1.461...HEAD
2108+
[Unreleased]: https://github.com/IFRCGo/go-api/compare/1.1.462...HEAD
2109+
[1.1.462]: https://github.com/IFRCGo/go-api/compare/1.1.461...1.1.462
21032110
[1.1.461]: https://github.com/IFRCGo/go-api/compare/1.1.460...1.1.461
21042111
[1.1.460]: https://github.com/IFRCGo/go-api/compare/1.1.459...1.1.460
21052112
[1.1.459]: https://github.com/IFRCGo/go-api/compare/1.1.458...1.1.459
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Generated by Django 3.2.16 on 2022-11-28 08:31
2+
3+
import country_plan.models
4+
import django.core.validators
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('country_plan', '0002_alter_countryplan_is_publish'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='countryplan',
17+
name='internal_plan_file',
18+
field=models.FileField(blank=True, null=True, upload_to=country_plan.models.pdf_upload_to, validators=[django.core.validators.FileExtensionValidator(['pdf'])], verbose_name='Internal Plan'),
19+
),
20+
migrations.AlterField(
21+
model_name='countryplan',
22+
name='public_plan_file',
23+
field=models.FileField(blank=True, null=True, upload_to=country_plan.models.pdf_upload_to, validators=[django.core.validators.FileExtensionValidator(['pdf'])], verbose_name='Country Plan'),
24+
),
25+
migrations.AlterField(
26+
model_name='strategicpriority',
27+
name='type',
28+
field=models.CharField(choices=[('ongoing_emergency_operations', 'Ongoing emergency operations'), ('climate_and_environmental_crisis', 'Climate and environmental crisis'), ('evolving_crisis_and_disasters', 'Evolving crisis and disasters'), ('growing_gaps_in_health_and_wellbeing', 'Growing gaps in health and wellbeing'), ('migration_and_identity', 'Migration and Identity'), ('value_power_and_inclusion', 'Value power and inclusion')], max_length=100, verbose_name='Type'),
29+
),
30+
]

country_plan/models.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from django.contrib.auth.models import User
33
from django.utils import timezone
44
from django.utils.translation import gettext_lazy as _
5+
from django.core.validators import FileExtensionValidator
56

67
from api.models import Country
78

@@ -63,8 +64,18 @@ def save(self, *args, **kwargs):
6364

6465
class CountryPlan(CountryPlanAbstract):
6566
country = models.OneToOneField(Country, on_delete=models.CASCADE, related_name='country_plan', primary_key=True)
66-
internal_plan_file = models.FileField(verbose_name=_('Internal Plan'), upload_to=pdf_upload_to, blank=True, null=True)
67-
public_plan_file = models.FileField(verbose_name=_('Country Plan'), upload_to=pdf_upload_to, blank=True, null=True)
67+
internal_plan_file = models.FileField(
68+
verbose_name=_('Internal Plan'),
69+
upload_to=pdf_upload_to,
70+
validators=[FileExtensionValidator(['pdf'])],
71+
blank=True, null=True
72+
)
73+
public_plan_file = models.FileField(
74+
verbose_name=_('Country Plan'),
75+
validators=[FileExtensionValidator(['pdf'])],
76+
upload_to=pdf_upload_to,
77+
blank=True, null=True
78+
)
6879
requested_amount = models.FloatField(verbose_name=_('Requested Amount'), blank=True, null=True)
6980
people_targeted = models.IntegerField(verbose_name=_('People Targeted'), blank=True, null=True)
7081
is_publish = models.BooleanField(default=False, verbose_name=_('Published'))
@@ -98,6 +109,7 @@ def full_country_plan_mc(self):
98109

99110
class StrategicPriority(models.Model):
100111
class Type(models.TextChoices):
112+
ONGOING_EMERGENCY_OPERATIONS = 'ongoing_emergency_operations', _('Ongoing emergency operations')
101113
CLIMATE_AND_ENVIRONMENTAL_CRISIS = 'climate_and_environmental_crisis', _('Climate and environmental crisis')
102114
EVOLVING_CRISIS_AND_DISASTERS = 'evolving_crisis_and_disasters', _('Evolving crisis and disasters')
103115
GROWING_GAPS_IN_HEALTH_AND_WELLBEING = 'growing_gaps_in_health_and_wellbeing', _('Growing gaps in health and wellbeing')

country_plan/tasks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class CountryPlanImporter():
2323
CSV_COLUMN = [
2424
'ISO3',
2525
'Country',
26+
'Ongoing emergency operations',
2627
'SP1 - Climate and environmental crisis',
2728
'SP2 - Evolving crises and disasters',
2829
'SP3 - Growing gaps in health and wellbeing',
@@ -78,12 +79,12 @@ def _save_country_plan(cls, row):
7879
country = Country.objects.filter(record_type=CountryType.COUNTRY).get(iso3=row.ISO3)
7980
# -- Country Plan
8081
country_plan, _ = CountryPlan.objects.get_or_create(country=country)
81-
country_plan.requested_amount = cls._process_number(row._17)
82-
country_plan.people_targeted = cls._process_number(row._8)
82+
country_plan.requested_amount = cls._process_number(row._18)
83+
country_plan.people_targeted = cls._process_number(row._9)
8384
country_plan.save()
8485

8586
# -- StrategicPriority
86-
target_values_list = [row._3, row._4, row._5, row._6, row._7]
87+
target_values_list = [row._3, row._4, row._5, row._6, row._7, row._8]
8788
sp_target_value_map = dict(zip(StrategicPriority.Type, target_values_list))
8889
for sp, t_people in sp_target_value_map.items():
8990
strategic_priority, _ = StrategicPriority.objects.get_or_create(

main/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
from .celery import app as celery_app
44

55
__all__ = ['celery_app']
6-
__version__ = '1.1.461'
6+
__version__ = '1.1.462'

mapbox/admin2/IDN-centroids.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 1,
3+
"layers": {
4+
"go-admin2-IDN-centroids": {
5+
"source": "mapbox://tileset-source/go-ifrc/go-admin2-IDN-centroids-src",
6+
"minzoom": 5,
7+
"maxzoom": 14
8+
}
9+
}
10+
}
11+

mapbox/admin2/IDN-staging.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 1,
3+
"layers": {
4+
"go-admin2-IDN-staging": {
5+
"source": "mapbox://tileset-source/go-ifrc/go-admin2-IDN-src-staging",
6+
"minzoom": 5,
7+
"maxzoom": 14
8+
}
9+
}
10+
}
11+

mapbox/admin2/IDN.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 1,
3+
"layers": {
4+
"go-admin2-IDN": {
5+
"source": "mapbox://tileset-source/go-ifrc/go-admin2-IDN-src",
6+
"minzoom": 5,
7+
"maxzoom": 14
8+
}
9+
}
10+
}
11+

mapbox/admin2/MYS-centroids.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 1,
3+
"layers": {
4+
"go-admin2-MYS-centroids": {
5+
"source": "mapbox://tileset-source/go-ifrc/go-admin2-MYS-centroids-src",
6+
"minzoom": 5,
7+
"maxzoom": 14
8+
}
9+
}
10+
}
11+

mapbox/admin2/MYS-staging.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 1,
3+
"layers": {
4+
"go-admin2-MYS-staging": {
5+
"source": "mapbox://tileset-source/go-ifrc/go-admin2-MYS-src-staging",
6+
"minzoom": 5,
7+
"maxzoom": 14
8+
}
9+
}
10+
}
11+

0 commit comments

Comments
 (0)