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 authored and AdityaKhatri committed Jan 16, 2024
1 parent b6559e5 commit 9742f02
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 12 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
1 change: 0 additions & 1 deletion apps/assessment_registry/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def batch_load_fn(self, keys):


class DataLoaders(WithContextMixin):

@cached_property
def stakeholders(self):
return AssessmentRegistryOrganizationsLoader(context=self.context)
Expand Down
2 changes: 1 addition & 1 deletion apps/lead/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def resolve_entries(root, info, **kwargs):
@staticmethod
def resolve_draft_entry_stat(root, info, **kwargs):
return info.context.dl.lead.draftentry_count.load(root.pk)

@staticmethod
def resolve_attachment(root, info, **kwargs):
if root.attachment_id:
Expand Down
4 changes: 0 additions & 4 deletions deep/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from analysis.dataloaders import DataLoaders as AnalysisDataLoaders
from gallery.dataloaders import DataLoaders as DeepGalleryDataLoaders
from assessment_registry.dataloaders import DataLoaders as AssessmentRegistryDataLoaders
from gallery.dataloaders import DataLoaders as DeepGalleryDataLoaders


class GlobalDataLoaders(WithContextMixin):
Expand Down Expand Up @@ -64,9 +63,6 @@ def analysis(self):
return AnalysisDataLoaders(context=self.context)

@cached_property
def deep_gallery(self):
return DeepGalleryDataLoaders(context=self.context)

def assessment_registry(self):
return AssessmentRegistryDataLoaders(context=self.context)

Expand Down
1 change: 0 additions & 1 deletion deep/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class Query(
export_schema.Query,
deep_explore_schema.Query,
analysis_public_schema.Query,
issue_schema.Query,
assessment_registry_schema.Query,
# --
graphene.ObjectType
Expand Down

0 comments on commit 9742f02

Please sign in to comment.