Skip to content

Commit

Permalink
Add country info in assessment registry export
Browse files Browse the repository at this point in the history
  • Loading branch information
Rup-Narayan-Rajbanshi committed Dec 28, 2023
1 parent b27cbda commit cd30166
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions apps/ary/export/affected_groups_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

def get_affected_groups_info(assessment):
affected_group_type_dict = {choice.value: choice.label for choice in AssessmentRegistry.AffectedGroupType}
affected_groups = [affected_group_type_dict.get(group) for group in assessment.affected_groups]
levels = [f'Level {i+1}' for i in range(5)]
affected_groups = [affected_group_type_dict.get(group) for group in assessment.affected_groups if group]
max_level = max([len(v.split('/')) for k, v in AssessmentRegistry.AffectedGroupType.choices])
levels = [f'Level {i+1}' for i in range(max_level)]
affected_grp_list = []
for group in affected_groups:
group = group.split("/")
Expand Down
2 changes: 1 addition & 1 deletion apps/ary/export/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_assessment_meta(assessment):
},

'background': {
'country': 'Afghanistan',
'country': ', '.join(country.title for country in assessment.locations.all()),
'crisis_type': assessment.get_bg_crisis_type_display(),
'crisis_start_date': assessment.bg_crisis_start_date,
'preparedness': assessment.get_bg_preparedness_display(),
Expand Down
2 changes: 1 addition & 1 deletion apps/ary/export/questionaire.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def get_questionaire(assessment):
questionaire_dict = {}
for sub_sector in sub_sector_list_set:
questionaire_dict[sub_sector] = {
answer.question.question: answer.answer
answer.question.question: 1 if answer.answer else 0
for answer in answers if answer.question.get_sub_sector_display() == sub_sector
}
return questionaire_dict
1 change: 0 additions & 1 deletion apps/assessment_registry/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
SummaryFocus,
SummarySubDimensionIssue,
SummaryIssue,
AdditionalDocument,
)


Expand Down

0 comments on commit cd30166

Please sign in to comment.