From 02824243feba6281b75686ca4f042b1a0b74af39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Porto?= Date: Fri, 2 Feb 2024 23:51:49 -0300 Subject: [PATCH] detail_report update and fixing --- report/templates/report/detail_report.html | 167 ++++++++++++--------- report/views.py | 7 +- 2 files changed, 103 insertions(+), 71 deletions(-) diff --git a/report/templates/report/detail_report.html b/report/templates/report/detail_report.html index a3ed384..3b480dd 100644 --- a/report/templates/report/detail_report.html +++ b/report/templates/report/detail_report.html @@ -9,21 +9,25 @@
    -
  • {% trans "Administrative" %} -
  • - {% if data.participants or data.resources or data.feedbacks or data.editors.count or data.organizers.count or data.partners_activated.count or data.technologies_used.count or data.wikipedia_created or data.wikipedia_edited or data.commons_created or data.commons_edited or data.wikidata_created or data.wikidata_edited or data.wikiversity_created or data.wikiversity_edited or data.wikibooks_created or data.wikibooks_edited or data.wikisource_created or data.wikisource_edited or data.wikinews_created or data.wikinews_edited or data.wikiquote_created or data.wikiquote_edited or data.wiktionary_created or data.wiktionary_edited or data.wikivoyage_created or data.wikivoyage_edited or data.wikispecies_created or data.wikispecies_edited or data.metawiki_created or data.metawiki_edited or data.mediawiki_created or data.mediawiki_edited %} +
  • {% trans "Administrative" %}
  • + {% if operations_with_value %} +
  • {% trans "Operational" %}
  • + {% endif %} + {% if data.participants or data.feedbacks or data.editors.count or data.organizers.count or data.technologies_used.count or data.wikipedia_created or data.wikipedia_edited or data.commons_created or data.commons_edited or data.wikidata_created or data.wikidata_edited or data.wikiversity_created or data.wikiversity_edited or data.wikibooks_created or data.wikibooks_edited or data.wikisource_created or data.wikisource_edited or data.wikinews_created or data.wikinews_edited or data.wikiquote_created or data.wikiquote_edited or data.wiktionary_created or data.wiktionary_edited or data.wikivoyage_created or data.wikivoyage_edited or data.wikispecies_created or data.wikispecies_edited or data.metawiki_created or data.metawiki_edited or data.mediawiki_created or data.mediawiki_edited %}
  • {% trans "Quantitative" %} {% if data.wikipedia_created or data.wikipedia_edited or data.commons_created or data.commons_edited or data.wikidata_created or data.wikidata_edited or data.wikiversity_created or data.wikiversity_edited or data.wikibooks_created or data.wikibooks_edited or data.wikisource_created or data.wikisource_edited or data.wikinews_created or data.wikinews_edited or data.wikiquote_created or data.wikiquote_edited or data.wiktionary_created or data.wiktionary_edited or data.wikivoyage_created or data.wikivoyage_edited or data.wikispecies_created or data.wikispecies_edited or data.metawiki_created or data.metawiki_edited or data.mediawiki_created or data.mediawiki_edited %} {% endif %} -
  • {% endif %} - {% if data.strategic_axis.count or data.directions_related.count or data.learning %} -
  • {% trans "Learning" %} -
  • {% endif %} - {% if data.learning_questions_related.count or evaluation_objective.count %} -
  • {% trans "Qualitative" %} -
  • {% endif %} + + {% endif %} + {% if data.directions_related.count %} +
  • {% trans "Strategic" %}
  • + {% endif %} + {% if data.learning_questions_related.count or data.learning %} +
  • {% trans "Learning" %}
  • + {% endif %} +
@@ -49,19 +53,17 @@
-

{% blocktrans with id_=data.id %}Report nº {{ id_ }}{% endblocktrans %}

-

{% trans "Administrative" %}

+

{% blocktrans with id_=data.id %}Report nº {{ id_ }}{% endblocktrans %}

+

{% trans "Administrative" %}

{% trans "Description" %}
{{ data.description }}
- {% if not data.activity_other %} -
-
{% trans "Activity associated" %}
-
{{ data.activity_associated.text }}
-
- {% endif %} +
+
{% trans "Activity associated" %}
+
{{ data.activity_associated.text }} ({{ data.activity_associated.code }})
+
{% trans "Area responsible" %}
{{ data.area_responsible }}
@@ -85,25 +87,69 @@

{% trans "Administrative" %}

{% if data.funding_associated.count %}
{% trans "Funding associated" %}
- {% for funding in data.funding_associated.all %} -
{{ funding.name }}
- {% endfor %} +
+ {% for funding in data.funding_associated.all %}{{ funding.name }}{% if not forloop.last %}
{% endif %}{% endfor %} +
{% endif %}
{% trans "Links" %}
{{ data.links|linebreaksbr }}
- {% if data.public_communication %} -
-
{% trans "Public communication" %}
-
{{ data.public_communication|linebreaksbr }}
-
- {% endif %}
- {% if data.participants or data.resources or data.feedbacks or data.editors.count or data.organizers.count or data.partners_activated.count or data.technologies_used.count or data.metrics_related.count or data.wikipedia_created or data.wikipedia_edited or data.commons_created or data.commons_edited or data.wikidata_created or data.wikidata_edited or data.wikiversity_created or data.wikiversity_edited or data.wikibooks_created or data.wikibooks_edited or data.wikisource_created or data.wikisource_edited or data.wikinews_created or data.wikinews_edited or data.wikiquote_created or data.wikiquote_edited or data.wiktionary_created or data.wiktionary_edited or data.wikivoyage_created or data.wikivoyage_edited or data.wikispecies_created or data.wikispecies_edited or data.metawiki_created or data.metawiki_edited or data.mediawiki_created or data.mediawiki_edited %} -

{% trans "Quantitative" %}

+ {% if operations_with_value and operations %} +
+

{% trans "Operational" %}

+ {% for operation in operations %} +
+

{{ operation.metric.activity }}

+
+
+
{{ operation.metric }}
+
+ {% if operation.number_of_events %} +
{% translate "Number of events" %}
+
{{ operation.number_of_events }}
+ {% endif %} + {% if operation.number_of_resources %} +
{% translate "Number of resources" %}
+
{{ operation.number_of_resources }}
+ {% endif %} + {% if operation.number_of_partnerships_activated %} +
{% translate "Number of partnerships activated" %}
+
{{ operation.number_of_partnerships_activated }}
+ {% endif %} + {% if operation.number_of_new_partnerships %} +
{% translate "Number of new partnerships" %}
+
{{ operation.number_of_new_partnerships }}
+ {% endif %} + {% if operation.number_of_new_followers %} +
{% translate "Number of new followers" %}
+
{{ operation.number_of_new_followers }}
+ {% endif %} + {% if operation.number_of_mentions %} +
{% translate "Number of mentions" %}
+
{{ operation.number_of_mentions }}
+ {% endif %} + {% if operation.number_of_people_reached_through_social_media %} +
{% translate "Number of people reached through social media" %}
+
{{ operation.number_of_people_reached_through_social_media }}
+ {% endif %} + {% if operation.number_of_community_communications %} +
{% translate "Number of community communications" %}
+
{{ operation.number_of_community_communications }}
+ {% endif %} +
+
+{# Number of mentions#} +{# Number of community communications#} +{# Number of people reached through social media#} + {% endfor %} +
+ {% endif %} + {% if data.participants or data.feedbacks or data.editors.count or data.organizers.count or data.technologies_used.count or data.wikipedia_created or data.wikipedia_edited or data.commons_created or data.commons_edited or data.wikidata_created or data.wikidata_edited or data.wikiversity_created or data.wikiversity_edited or data.wikibooks_created or data.wikibooks_edited or data.wikisource_created or data.wikisource_edited or data.wikinews_created or data.wikinews_edited or data.wikiquote_created or data.wikiquote_edited or data.wiktionary_created or data.wiktionary_edited or data.wikivoyage_created or data.wikivoyage_edited or data.wikispecies_created or data.wikispecies_edited or data.metawiki_created or data.metawiki_edited or data.mediawiki_created or data.mediawiki_edited %}
+

{% trans "Quantitative" %}

{% if data.metrics_related %}
{% trans "Metrics related" %}
@@ -116,24 +162,12 @@

{% trans "Quantitative" %}

{{ data.participants }}
{% endif %} - {% if data.resources %} -
-
{% trans "Number of resources" %}
-
{{ data.resources }}
-
- {% endif %} {% if data.feedbacks %}
{% trans "Number of feedbacks" %}
{{ data.feedbacks }}
{% endif %} - {% if data.number_of_people_reached_through_social_media %} -
-
{% trans "Number of people reached through social media" %}
-
{{ data.number_of_people_reached_through_social_media }}
-
- {% endif %} {% if data.editors.count %}
{% trans "Editors" %}
@@ -149,13 +183,13 @@

{% trans "Quantitative" %}

{% if data.partners_activated.count %}
{% trans "Partnerships activated" %}
-
{% for partners in data.partners_activated.all %}{{ partners.name }}{% endfor %}
+
{% for partners in data.partners_activated.all %}{{ partners.name }}{% if not forloop.last %}; {% endif %}{% endfor %}
{% endif %} {% if data.technologies_used.count %}
{% trans "Technologies used" %}
-
{% for technology in data.technologies_used.all %}{{ technology.name }}{% endfor %}
+
{% for technology in data.technologies_used.all %}{{ technology.name }}{% if not forloop.last %}; {% endif %}{% endfor %}
{% endif %}
@@ -261,41 +295,34 @@

{% trans "Wikimedia projects" %}

{% endif %} {% endif %} - {% if data.strategic_axis.count or data.directions_related.count or data.learning %} -

{% trans "Learning" %}

+ {% if data.directions_related.count %}
-

{% trans "Strategic axis" %}

- {% if data.directions_related.count %} -
{% trans "Directions associated" %}
-
-
- {% for direction in data.directions_related.all %}{{ direction.text }}{% if not forloop.last %}
{% endif %}{% endfor %} -
-
- {% endif %} -
{% trans "Learning of the activity" %}
+

{% trans "Strategic" %}

+
{% trans "Directions associated" %}
-
{{ data.learning|linebreaksbr }}
+ {% for direction in data.directions_related.all %} +
{{ direction.text }}
+ {% endfor %}
{% endif %} - {% if data.learning_questions_related.count or evaluation_objective.count %} -

{% trans "Qualitative" %}

+ {% if data.learning_questions_related.count or data.learning %}
+

{% trans "Learning" %}

{% if data.learning_questions_related.count %} -

{% trans "Strategic learning questions" %}

- {% for question in data.learning_questions_related.all %} -
{{ question.text }}
- {% endfor %} +
+
{% trans "Strategic learning questions" %}
+
+ {% for question in data.learning_questions_related.all %} +
{{ question.text }}
+ {% endfor %}
+
{% endif %} - {% if evaluation_objective.count %} -

{% trans "Evaluation objectives" %}

- {% for evaluation_objective_answer in evaluation_objective.all %} -
{{ evaluation_objective_answer.objective.text }}
-
-
{{ evaluation_objective_answer.answer }}
-
- {% endfor %} + {% if data.learning %} +
+
{% trans "Learning of the activity" %}
+
{{ data.learning|linebreaksbr }}
+
{% endif %}
{% endif %} diff --git a/report/views.py b/report/views.py index fa40103..6f60312 100644 --- a/report/views.py +++ b/report/views.py @@ -136,7 +136,12 @@ def list_reports(request): @login_required @permission_required("report.view_report") def detail_report(request, report_id): - context = {"data": Report.objects.get(id=report_id), + report = Report.objects.get(id=report_id) + operations = OperationReport.objects.filter(report=report) + operations_with_value =operations.filter(Q(number_of_people_reached_through_social_media__gt=0) | Q(number_of_new_followers__gt=0) | Q(number_of_mentions__gt=0) | Q(number_of_community_communications__gt=0) | Q(number_of_events__gt=0) | Q(number_of_resources__gt=0) | Q(number_of_partnerships_activated__gt=0) | Q(number_of_new_partnerships__gt=0)).exists() + context = {"data": report, + "operations": OperationReport.objects.filter(report=report), + "operations_with_value": operations_with_value, "title": _("View report %(report_id)s") % {"report_id": report_id}} return render(request, "report/detail_report.html", context)