Skip to content

Commit 517a31b

Browse files
authored
Merge pull request #2993 from unicef/develop
staging
2 parents 1129698 + 0beb3d3 commit 517a31b

File tree

3 files changed

+55
-30
lines changed

3 files changed

+55
-30
lines changed

src/etools/applications/audit/views.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -518,29 +518,28 @@ def perform_create(self, serializer, **kwargs):
518518
def perform_update(self, serializer):
519519
self.check_serializer_permissions(serializer, edit=True)
520520

521-
hidden_staff = AuditorStaffMember.objects.filter(
522-
user__email=getattr(serializer.validated_data['user'], 'email', ''),
523-
hidden=True,
524-
).first()
525-
if hidden_staff:
526-
if hidden_staff.auditor_firm != self.get_parent_object():
527-
raise ValidationError(f'User already associated with {hidden_staff.auditor_firm}')
528-
else:
529-
hidden_staff.hidden = False
530-
timestamp = str(now())
531-
hidden_staff.history.append(
532-
f'requestor:{self.request.user.username},hidden:{hidden_staff.hidden},timestamp:{timestamp}'
533-
)
534-
hidden_staff.save()
535-
deactivated_user = hidden_staff.user
536-
deactivated_user.is_active = True
537-
deactivated_user.save()
538-
deleted_profile = hidden_staff.user.profile
539-
deleted_profile.countries_available.add(self.request.tenant)
540-
if not deleted_profile.country:
541-
deleted_profile.country = self.request.tenant
542-
deleted_profile.save()
543-
return
521+
if 'email' in serializer.validated_data['user']:
522+
hidden_staff = AuditorStaffMember.objects.filter(
523+
user__email=serializer.validated_data['user']['email'], hidden=True).first()
524+
if hidden_staff:
525+
if hidden_staff.auditor_firm != self.get_parent_object():
526+
raise ValidationError(f'User already associated with {hidden_staff.auditor_firm}')
527+
else:
528+
hidden_staff.hidden = False
529+
timestamp = str(now())
530+
hidden_staff.history.append(
531+
f'requestor:{self.request.user.username},hidden:{hidden_staff.hidden},timestamp:{timestamp}'
532+
)
533+
hidden_staff.save()
534+
deactivated_user = hidden_staff.user
535+
deactivated_user.is_active = True
536+
deactivated_user.save()
537+
deleted_profile = hidden_staff.user.profile
538+
deleted_profile.countries_available.add(self.request.tenant)
539+
if not deleted_profile.country:
540+
deleted_profile.country = self.request.tenant
541+
deleted_profile.save()
542+
return
544543

545544
super().perform_update(serializer)
546545
instance = serializer.save(auditor_firm=self.get_parent_object())

src/etools/applications/core/data/field_monitoring_questions.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@
639639
"choices_size": null,
640640
"level": "partner",
641641
"category": 6,
642-
"text": "Proportion of interviewed partner personnel (staff, consultants, volunteers, interns, sub-contractors) in the location who have received a training on PSEA In the last 12 months that meets the minimum criteria?",
642+
"text": "Proportion of partner personnel (staff, consultants, volunteers, interns, sub-contractors) in the location who have received a training on PSEA In the last 12 months that meets the minimum criteria?",
643643
"is_hact": false,
644644
"is_custom": false,
645645
"is_active": true,
@@ -658,7 +658,7 @@
658658
"choices_size": null,
659659
"level": "partner",
660660
"category": 6,
661-
"text": "Proportion of interviewed beneficiaries in the programme location that can explain at least one channel to report SEA (such as SMS, phone hotline, email, feedback box, PSEA focal point from partner organization)",
661+
"text": "Proportion of beneficiaries in the programme location that can explain at least one channel to report SEA (such as SMS, phone hotline, email, feedback box, PSEA focal point from partner organization)",
662662
"is_hact": false,
663663
"is_custom": false,
664664
"is_active": true,
@@ -1493,7 +1493,7 @@
14931493
"pk": 1092,
14941494
"fields": {
14951495
"question": 1035,
1496-
"label": "None of interviewed beneficiaries are aware",
1496+
"label": "None of the beneficiaries are aware",
14971497
"value": "1"
14981498
}
14991499
},
@@ -1502,7 +1502,7 @@
15021502
"pk": 1093,
15031503
"fields": {
15041504
"question": 1035,
1505-
"label": "1-25% of interviewed beneficiaries are aware",
1505+
"label": "1-25% of beneficiaries are aware",
15061506
"value": "2"
15071507
}
15081508
},
@@ -1511,7 +1511,7 @@
15111511
"pk": 1094,
15121512
"fields": {
15131513
"question": 1035,
1514-
"label": "26-50% of interviewed beneficiaries are aware",
1514+
"label": "26-50% of beneficiaries are aware",
15151515
"value": "3"
15161516
}
15171517
},
@@ -1520,7 +1520,7 @@
15201520
"pk": 1095,
15211521
"fields": {
15221522
"question": 1035,
1523-
"label": "51%-75% of interviewed beneficiaries are aware",
1523+
"label": "51%-75% of beneficiaries are aware",
15241524
"value": "4"
15251525
}
15261526
},
@@ -1529,7 +1529,7 @@
15291529
"pk": 1096,
15301530
"fields": {
15311531
"question": 1035,
1532-
"label": "76%-100% of interviewed beneficiaries are aware",
1532+
"label": "76%-100% of beneficiaries are aware",
15331533
"value": "5"
15341534
}
15351535
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[
2+
{
3+
"model": "field_monitoring_planning.questiontemplate",
4+
"pk": 1034,
5+
"fields": {
6+
"partner": null,
7+
"cp_output": null,
8+
"intervention": null,
9+
"question": 1034,
10+
"is_active": true,
11+
"specific_details": "Minimum criteria for PSEA training include the following :1) a definition of SEA (that is aligned with the UN's definition); 2) explanation on prohibition of SEA; and 3) actions that personnel are required to take (i.e. prompt reporting of allegations and X- partner staff X- partner staff Scale -5 None 1-25% have received training. 26%-50% have received training. 51-75% have received training. 76-100% have received training. Corresponds to indicator in Output 2.3, Results Monitoring Framework referral of victims)."
12+
}
13+
},
14+
{
15+
"model": "field_monitoring_planning.questiontemplate",
16+
"pk": 1035,
17+
"fields": {
18+
"partner": null,
19+
"cp_output": null,
20+
"intervention": null,
21+
"question": 1035,
22+
"is_active": true,
23+
"specific_details": "Necessary elements include: 1. Available in the local language; 2. Adapted for different levels of literacy; 3. Contact information is clear (SMS, email or phone number); 4. Design is child-sensitive."
24+
}
25+
}
26+
]

0 commit comments

Comments
 (0)