diff --git a/akvo/rsr/iati/sector_mappings.py b/akvo/rsr/iati/sector_mappings.py index 51335cc0b4..57032ccf38 100644 --- a/akvo/rsr/iati/sector_mappings.py +++ b/akvo/rsr/iati/sector_mappings.py @@ -79,6 +79,10 @@ 115: (41081,), 116: (41082,), 122: (41020,), + 123: (25010,), + 124: (25010,), + 125: (31130,), + 126: (15150,), 24: (), 21: (), 25: (), diff --git a/akvo/rsr/models/project.py b/akvo/rsr/models/project.py index c4bf45ceb8..a0638862e0 100644 --- a/akvo/rsr/models/project.py +++ b/akvo/rsr/models/project.py @@ -734,6 +734,18 @@ def siblings(self): return (Project.objects.filter(related_projects__related_project=self, related_projects__relation=3) | Project.objects.filter(related_to_projects__project=self, related_to_projects__relation=3)).distinct() + def has_results(self): + for result in self.results.all(): + if result.title or result.type or result.aggregation_status or result.description: + return True + return False + + def has_indicators(self): + for result in self.results.all(): + if result.indicators.all(): + return True + return False + class Meta: app_label = 'rsr' verbose_name = _(u'project') diff --git a/akvo/rsr/models/result.py b/akvo/rsr/models/result.py index 882209ea9a..a9d0cc74b0 100644 --- a/akvo/rsr/models/result.py +++ b/akvo/rsr/models/result.py @@ -28,6 +28,11 @@ def __unicode__(self): def iati_type(self): return dict(codelists.RESULT_TYPE)[self.type] if self.type else "" + def has_info(self): + if self.title or self.type or self.aggregation_status or self.description: + return True + return False + class Meta: app_label = 'rsr' verbose_name = _(u'result') diff --git a/akvo/templates/partials/project_header.html b/akvo/templates/partials/project_header.html index 6ac9ef09fe..05e8826714 100644 --- a/akvo/templates/partials/project_header.html +++ b/akvo/templates/partials/project_header.html @@ -16,7 +16,9 @@

{{project.title}}

Follow project {% url 'project-report' project.pk as report_url %} {% if not request.get_full_path == report_url %} - Show full data report + Show full data report + {% else %} + Print this page {% endif %} diff --git a/akvo/templates/project_report.html b/akvo/templates/project_report.html index a95a6f9d81..bb821cdcc5 100644 --- a/akvo/templates/project_report.html +++ b/akvo/templates/project_report.html @@ -22,7 +22,7 @@

{% trans "Identifiers" %}

{% for partnership in project.partnerships.all %} {% if partnership.internal_id %} - {{partnership.organisation.name}} {% trans "ID" %} + {{partnership.organisation}} {% trans "ID" %} {{partnership.internal_id}} {% endif %} @@ -435,21 +435,41 @@

{% trans "Conditions" %}

{% endif %} - {% if project.results.all %} + {% if project.has_results %}

{% trans "Results" %}

+ + + + + + + + + + + {% for result in project.results.all %} + {% if result.has_info %} + + + + + + + {% endif %} + {% endfor %} + +
{% trans "Result" %}{% trans "Type" %}{% trans "Aggregation Status" %}{% trans "Description" %}
{{result.title}}{{result.iati_type}}{{result.aggregation_status|yesno:"Aggregatable,Not Aggregatable,"}}{{result.description}}
+ {% endif%} + {% if project.has_indicators %} +

{% trans "Indicators" %}

- - - - - @@ -458,23 +478,18 @@

{% trans "Results" %}

{% for result in project.results.all %} + {% for indicator in result.indicators.all %} - - - - {% for indicator in result.indicators.all %} - {% if not forloop.first %} - - {% endif %} - - - + {% for period in indicator.periods.all %} {% if not forloop.first %} - + {% endif %} @@ -483,11 +498,9 @@

{% trans "Results" %}

{% empty %} {% endfor %} - {% empty %} - - {% endfor %} {% endfor %} + {% endfor %}
{% trans "Result" %}{% trans "Type" %}{% trans "Aggregation Status" %} {% trans "Indicator" %} {% trans "Measure" %} {% trans "Ascending" %} {% trans "Baseline" %}{% trans "Baseline Year" %}{% trans "Baseline Value" %} {% trans "Period Start" %} {% trans "Period End" %} {% trans "Target Value" %}
{{result.title}}{{result.iati_type}}{{result.aggregation_status|yesno:"Aggregatable,Not Aggregatable,"}}
{{indicator.title}} {{indicator.iati_measure}} {{indicator.ascending|yesno:"Ascending,Descending,"}}{{indicator.baseline_comment}}{{indicator.baseline_year|default_if_none:""}}{{indicator.baseline_value}}{% if indicator.baseline_year %}{% trans "In" %}: {{indicator.baseline_year}}{% endif %} + {{indicator.baseline_value}} + {% if indicator.baseline_comment %}({{indicator.baseline_comment}}){% endif %} +
{{period.period_start|default_if_none:""}} {{period.period_end|default_if_none:""}}