Skip to content

Commit 07e98b5

Browse files
Merge pull request #1635 from IFRCGo/develop
Release 1.1.466
2 parents 011bf26 + e88acdc commit 07e98b5

38 files changed

+92
-73
lines changed

CHANGELOG.md

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

77
## Unreleased
88

9+
## 1.1.466
10+
11+
### Added
12+
- DREF Final Report finalization + new features
13+
- LocalUnits – first steps
14+
- Event visibility fix
15+
916
## 1.1.465
1017

1118
### Added
@@ -2126,7 +2133,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
21262133

21272134
## 0.1.20
21282135

2129-
[Unreleased]: https://github.com/IFRCGo/go-api/compare/1.1.465...HEAD
2136+
[Unreleased]: https://github.com/IFRCGo/go-api/compare/1.1.466...HEAD
2137+
[1.1.466]: https://github.com/IFRCGo/go-api/compare/1.1.465...1.1.466
21302138
[1.1.465]: https://github.com/IFRCGo/go-api/compare/1.1.464...1.1.465
21312139
[1.1.464]: https://github.com/IFRCGo/go-api/compare/1.1.463...1.1.464
21322140
[1.1.463]: https://github.com/IFRCGo/go-api/compare/1.1.462...1.1.463

api/drf_views.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from deployments.models import Personnel
1919
from databank.serializers import CountryOverviewSerializer
2020

21+
from .utils import is_user_ifrc
2122
from .event_sources import SOURCES
2223
from .exceptions import BadRequest
2324
from .view_filters import ListFilter
@@ -437,10 +438,20 @@ def retrieve(self, request, pk=None, *args, **kwargs):
437438
if pk:
438439
try:
439440
if self.request.user.is_authenticated:
440-
if self.request.user.is_superuser:
441+
if is_user_ifrc(self.request.user):
441442
instance = Event.objects.get(pk=pk)
442443
else:
443-
instance = Event.objects.exclude(visibility=VisibilityChoices.IFRC).exclude(Q(visibility=VisibilityChoices.IFRC_NS) & ~Q(countries__id__in=UserCountry.objects.filter(user=self.request.user.id).values_list('country',flat=True).union(Profile.objects.filter(user=self.request.user.id).values_list('country',flat=True)))).get(pk=pk)
444+
user_countries = UserCountry.objects\
445+
.filter(user=request.user.id).values('country')\
446+
.union(
447+
Profile.objects.filter(user=request.user.id).values('country')
448+
)
449+
instance = Event.objects\
450+
.exclude(
451+
visibility=VisibilityChoices.IFRC)\
452+
.exclude(
453+
Q(visibility=VisibilityChoices.IFRC_NS) & ~Q(countries__id__in=user_countries))\
454+
.get(pk=pk)
444455
else:
445456
instance = Event.objects.filter(visibility=VisibilityChoices.PUBLIC).get(pk=pk)
446457
# instance = Event.get_for(request.user).get(pk=pk)

api/management/commands/index_and_notify.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,11 @@ def construct_template_record(self, rtype, record):
479479
'gov_assistance': 'Yes' if record.request_assistance else 'No',
480480
'ns_assistance': 'Yes' if record.ns_request_assistance else 'No',
481481
'dtype_id': record.dtype_id,
482-
'visibility': record.visibility,
482+
'visibility': record.get_visibility_display(),
483483
'other_fields': {
484-
'appeal': record.appeal,
484+
'appeal': record.get_appeal_display(),
485485
'appeal_amount': record.appeal_amount,
486-
'bulletin': record.bulletin,
486+
'bulletin': record.get_bulletin_display(),
487487
'countries': ', '.join(i.name for i in record.countries.all()),
488488
'contacts': [{'ctype': c.ctype,
489489
'name': c.name,
@@ -492,59 +492,59 @@ def construct_template_record(self, rtype, record):
492492
'phone': c.phone} for c in record.contacts.all()[::-1]],
493493
#not used this way, but shortened: 'description': record.description,
494494
'districts': ', '.join(i.name for i in record.districts.all()),
495-
'dref': record.dref,
495+
'dref': record.get_dref_display(),
496496
'dref_amount': record.dref_amount,
497497
'epi_cases_since_last_fr': record.epi_cases_since_last_fr,
498498
'epi_deaths_since_last_fr': record.epi_deaths_since_last_fr,
499499
'epi_notes_since_last_fr': record.epi_notes_since_last_fr.split("\n") if record.epi_notes_since_last_fr else None,
500-
'eru_base_camp': record.eru_base_camp,
500+
'eru_base_camp': record.get_eru_base_camp_display(),
501501
'eru_base_camp_units': record.eru_base_camp_units,
502-
'eru_basic_health_care': record.eru_basic_health_care,
502+
'eru_basic_health_care': record.get_eru_basic_health_care_display(),
503503
'eru_basic_health_care_units': record.eru_basic_health_care_units,
504-
'eru_deployment_hospital': record.eru_deployment_hospital,
504+
'eru_deployment_hospital': record.get_eru_deployment_hospital_display(),
505505
'eru_deployment_hospital_units': record.eru_deployment_hospital_units,
506-
'eru_it_telecom': record.eru_it_telecom,
506+
'eru_it_telecom': record.get_eru_it_telecom_display(),
507507
'eru_it_telecom_units': record.eru_it_telecom_units,
508-
'eru_logistics': record.eru_logistics,
508+
'eru_logistics': record.get_eru_logistics_display(),
509509
'eru_logistics_units': record.eru_logistics_units,
510-
'eru_referral_hospital': record.eru_referral_hospital,
510+
'eru_referral_hospital': record.get_eru_referral_hospital_display(),
511511
'eru_referral_hospital_units': record.eru_referral_hospital_units,
512-
'eru_relief': record.eru_relief,
512+
'eru_relief': record.get_eru_relief_display(),
513513
'eru_relief_units': record.eru_relief_units,
514-
'eru_water_sanitation_15': record.eru_water_sanitation_15,
514+
'eru_water_sanitation_15': record.get_eru_water_sanitation_15_display(),
515515
'eru_water_sanitation_15_units': record.eru_water_sanitation_15_units,
516-
'eru_water_sanitation_20': record.eru_water_sanitation_20,
516+
'eru_water_sanitation_20': record.get_eru_water_sanitation_20_display(),
517517
'eru_water_sanitation_20_units': record.eru_water_sanitation_20_units,
518-
'eru_water_sanitation_40': record.eru_water_sanitation_40,
518+
'eru_water_sanitation_40': record.get_eru_water_sanitation_40_display(),
519519
'eru_water_sanitation_40_units': record.eru_water_sanitation_40_units,
520520
'event': record.event,
521521
'external_partners': ', '.join(i.name for i in record.external_partners.all()),
522-
'forecast_based_action': record.forecast_based_action,
522+
'forecast_based_action': record.get_forecast_based_action_display(),
523523
'forecast_based_action_amount': record.forecast_based_action_amount,
524-
'imminent_dref': record.imminent_dref,
524+
'imminent_dref': record.get_imminent_dref_display(),
525525
'imminent_dref_amount': record.imminent_dref_amount,
526526
'notes_health': record.notes_health,
527527
'notes_ns': record.notes_ns,
528528
'notes_socioeco': record.notes_socioeco,
529529
'other_sources': record.other_sources.split("\n") if record.other_sources else None,
530530
'start_date': record.start_date,
531531
'supported_activities': ', '.join(i.name for i in record.supported_activities.all()),
532-
# not used: 'fact': record.fact,
532+
# not used: 'fact': record.fact, !get_..._display!
533533
# not used: 'affected_pop_centres': record.affected_pop_centres,
534534
# not used: 'gov_affected_pop_centres': record.gov_affected_pop_centres,
535535
# not used: 'gov_num_highest_risk': record.gov_num_highest_risk,
536536
# not used: 'gov_num_potentially_affected': record.gov_num_potentially_affected,
537537
# not used: 'health_min_num_assisted': record.health_min_num_assisted,
538538
# not used: 'who_num_assisted': record.who_num_assisted,
539-
# not used: 'ifrc_staff': record.ifrc_staff,
539+
# not used: 'ifrc_staff': record.ifrc_staff, !get_..._display!
540540
# not used: 'is_covid_report': record.is_covid_report,
541541
# not used: 'num_expats_delegates': record.num_expats_delegates,
542542
# not used: 'num_fact': record.num_fact,
543543
# not used: 'num_highest_risk': record.num_highest_risk,
544544
# not used: 'num_ifrc_staff': record.num_ifrc_staff,
545545
# not used: 'num_localstaff': record.num_localstaff,
546546
# not used: 'num_potentially_affected': record.num_potentially_affected,
547-
# not used: 'rdrt': record.rdrt,
547+
# not used: 'rdrt': record.rdrt, !get_..._display!
548548
# not used: 'num_rdrt': record.num_rdrt,
549549
# not used: 'num_volunteers': record.num_volunteers,
550550
# not used: 'other_affected_pop_centres': record.other_affected_pop_centres,
@@ -727,7 +727,7 @@ def notify(self, records, rtype, stype, uid=None):
727727
# Handle Visibility for Field Reports
728728
if rtype == RecordType.FIELD_REPORT:
729729
rtype_of_subscr, stype = self.fix_types_for_subs(rtype, stype)
730-
non_ifrc_records = [rec for rec in record_entries if int(rec['visibility']) != 2]
730+
non_ifrc_records = [rec for rec in record_entries if rec['visibility'] != 'IFRC Only']
731731
if non_ifrc_records:
732732
non_ifrc_filters = (Q(subscription__rtype=rtype_of_subscr) &
733733
Q(subscription__stype=stype) &

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.465'
6+
__version__ = '1.1.466'

mapbox/admin2/COL-centroids.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"go-admin2-COL-centroids": {
55
"source": "mapbox://tileset-source/go-ifrc/go-admin2-COL-centroids-src",
66
"minzoom": 5,
7-
"maxzoom": 14
7+
"maxzoom": 10
88
}
99
}
1010
}

mapbox/admin2/COL-staging.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"go-admin2-COL-staging": {
55
"source": "mapbox://tileset-source/go-ifrc/go-admin2-COL-src-staging",
66
"minzoom": 5,
7-
"maxzoom": 14
7+
"maxzoom": 10
88
}
99
}
1010
}

mapbox/admin2/COL.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"go-admin2-COL": {
55
"source": "mapbox://tileset-source/go-ifrc/go-admin2-COL-src",
66
"minzoom": 5,
7-
"maxzoom": 14
7+
"maxzoom": 10
88
}
99
}
1010
}

mapbox/admin2/GTM-centroids.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"go-admin2-GTM-centroids": {
55
"source": "mapbox://tileset-source/go-ifrc/go-admin2-GTM-centroids-src",
66
"minzoom": 5,
7-
"maxzoom": 14
7+
"maxzoom": 10
88
}
99
}
1010
}

mapbox/admin2/GTM-staging.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"go-admin2-GTM-staging": {
55
"source": "mapbox://tileset-source/go-ifrc/go-admin2-GTM-src-staging",
66
"minzoom": 5,
7-
"maxzoom": 14
7+
"maxzoom": 10
88
}
99
}
1010
}

mapbox/admin2/GTM.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"go-admin2-GTM": {
55
"source": "mapbox://tileset-source/go-ifrc/go-admin2-GTM-src",
66
"minzoom": 5,
7-
"maxzoom": 14
7+
"maxzoom": 10
88
}
99
}
1010
}

0 commit comments

Comments
 (0)