From 92155fb742082f00f366527f7b7444e302c27941 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Mon, 18 Oct 2021 15:52:51 +0200 Subject: [PATCH 01/14] #26 Annual conservation report * introduces new app 'analysis' for annual report generating and future features * adds new templates (WIP) * adds new routes (WIP) --- analysis/__init__.py | 0 analysis/admin.py | 3 + analysis/apps.py | 5 + analysis/models.py | 3 + .../templates/analysis/reports/detail.html | 17 + .../reports/includes/card_compensation.html | 23 ++ .../reports/includes/card_eco_account.html | 23 ++ .../includes/card_old_interventions.html | 24 ++ .../reports/includes/intervention/amount.html | 30 ++ .../intervention/card_intervention.html | 26 ++ .../includes/intervention/compensated_by.html | 34 ++ .../reports/includes/intervention/laws.html | 50 +++ .../templates/analysis/reports/index.html | 8 + analysis/tests.py | 3 + analysis/urls.py | 15 + analysis/utils/report.py | 127 +++++++ analysis/views.py | 59 ++++ konova/sub_settings/django_settings.py | 1 + konova/urls.py | 3 +- locale/de/LC_MESSAGES/django.mo | Bin 24781 -> 25176 bytes locale/de/LC_MESSAGES/django.po | 311 +++++++++++------- templates/navbars/navbar.html | 2 +- 22 files changed, 641 insertions(+), 126 deletions(-) create mode 100644 analysis/__init__.py create mode 100644 analysis/admin.py create mode 100644 analysis/apps.py create mode 100644 analysis/models.py create mode 100644 analysis/templates/analysis/reports/detail.html create mode 100644 analysis/templates/analysis/reports/includes/card_compensation.html create mode 100644 analysis/templates/analysis/reports/includes/card_eco_account.html create mode 100644 analysis/templates/analysis/reports/includes/card_old_interventions.html create mode 100644 analysis/templates/analysis/reports/includes/intervention/amount.html create mode 100644 analysis/templates/analysis/reports/includes/intervention/card_intervention.html create mode 100644 analysis/templates/analysis/reports/includes/intervention/compensated_by.html create mode 100644 analysis/templates/analysis/reports/includes/intervention/laws.html create mode 100644 analysis/templates/analysis/reports/index.html create mode 100644 analysis/tests.py create mode 100644 analysis/urls.py create mode 100644 analysis/utils/report.py create mode 100644 analysis/views.py diff --git a/analysis/__init__.py b/analysis/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/analysis/admin.py b/analysis/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/analysis/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/analysis/apps.py b/analysis/apps.py new file mode 100644 index 00000000..126ab0e5 --- /dev/null +++ b/analysis/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class AnalysisConfig(AppConfig): + name = 'analysis' diff --git a/analysis/models.py b/analysis/models.py new file mode 100644 index 00000000..71a83623 --- /dev/null +++ b/analysis/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/analysis/templates/analysis/reports/detail.html b/analysis/templates/analysis/reports/detail.html new file mode 100644 index 00000000..219ad46d --- /dev/null +++ b/analysis/templates/analysis/reports/detail.html @@ -0,0 +1,17 @@ +{% extends 'base.html' %} +{% load i18n fontawesome_5 %} + +{% block body %} +
+
+

{% trans 'Report' %}

+
{{office.long_name}}
+
+
+
+ {% include 'analysis/reports/includes/intervention/card_intervention.html' %} + {% include 'analysis/reports/includes/card_compensation.html' %} + {% include 'analysis/reports/includes/card_eco_account.html' %} + {% include 'analysis/reports/includes/card_old_interventions.html' %} +
+{% endblock %} \ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/card_compensation.html b/analysis/templates/analysis/reports/includes/card_compensation.html new file mode 100644 index 00000000..24d0eabf --- /dev/null +++ b/analysis/templates/analysis/reports/includes/card_compensation.html @@ -0,0 +1,23 @@ +{% load i18n fontawesome_5 %} + +
+
+
+
+
+
+
+ {% fa5_icon 'leaf' %} + {% trans 'Compensations' %} +
+
+
+
+
+
+ {% include 'form/table/generic_table_form_body.html' %} +
+
+
+
+
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/card_eco_account.html b/analysis/templates/analysis/reports/includes/card_eco_account.html new file mode 100644 index 00000000..744ce07f --- /dev/null +++ b/analysis/templates/analysis/reports/includes/card_eco_account.html @@ -0,0 +1,23 @@ +{% load i18n fontawesome_5 %} + +
+
+
+
+
+
+
+ {% fa5_icon 'tree' %} + {% trans 'Eco-Accounts' %} +
+
+
+
+
+
+ {% include 'form/table/generic_table_form_body.html' %} +
+
+
+
+
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/card_old_interventions.html b/analysis/templates/analysis/reports/includes/card_old_interventions.html new file mode 100644 index 00000000..400d0085 --- /dev/null +++ b/analysis/templates/analysis/reports/includes/card_old_interventions.html @@ -0,0 +1,24 @@ +{% load i18n fontawesome_5 %} + +
+
+
+
+
+
+
+ {% fa5_icon 'pencil-ruler' %} + {% trans 'Old interventions' %} +
+ {% trans 'Before' %} 16.06.2018 +
+
+
+
+
+ {% include 'form/table/generic_table_form_body.html' %} +
+
+
+
+
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/intervention/amount.html b/analysis/templates/analysis/reports/includes/intervention/amount.html new file mode 100644 index 00000000..a146d4b2 --- /dev/null +++ b/analysis/templates/analysis/reports/includes/intervention/amount.html @@ -0,0 +1,30 @@ +{% load i18n fontawesome_5 %} + +

{% trans 'Amount' %}

+ + {% blocktrans %} + Checked = Has been checked by the registration office according to LKompVzVo + {% endblocktrans %} +
+ {% blocktrans %} + Recorded = Has been checked and published by the conservation office + {% endblocktrans %} +
+
+ + + + + + + + + + + + + + + +
{% trans 'Total' %}{% fa5_icon 'star' %} {% trans 'Checked' %}{% fa5_icon 'bookmark' %} {% trans 'Recorded' %}
{{report.intervention_report.queryset.count}}{{report.intervention_report.queryset_checked.count}}{{report.intervention_report.queryset_recorded.count}}
+
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/intervention/card_intervention.html b/analysis/templates/analysis/reports/includes/intervention/card_intervention.html new file mode 100644 index 00000000..13c22892 --- /dev/null +++ b/analysis/templates/analysis/reports/includes/intervention/card_intervention.html @@ -0,0 +1,26 @@ +{% load i18n fontawesome_5 %} +
+
+
+
+
+
+
+ {% fa5_icon 'pencil-ruler' %} + {% trans 'Interventions' %} +
+
+
+
+
+
+ {% include 'analysis/reports/includes/intervention/amount.html' %} +
+ {% include 'analysis/reports/includes/intervention/laws.html' %} +
+ {% include 'analysis/reports/includes/intervention/compensated_by.html' %} +
+
+
+
+
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/intervention/compensated_by.html b/analysis/templates/analysis/reports/includes/intervention/compensated_by.html new file mode 100644 index 00000000..87dfc570 --- /dev/null +++ b/analysis/templates/analysis/reports/includes/intervention/compensated_by.html @@ -0,0 +1,34 @@ +{% load i18n fontawesome_5 %} +

{% trans 'Compensated by' %}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans 'Compensation type' %}{% trans 'Total' %}{% trans 'Checked' %}{% trans 'Recorded' %}
{% trans 'Compensation' %}{{report.intervention_report.compensation_sum}}{{report.intervention_report.compensation_sum_checked}}{{report.intervention_report.compensation_sum_recorded}}
{% trans 'Payment' %}{{report.intervention_report.payment_sum}}{{report.intervention_report.payment_sum_checked}}{{report.intervention_report.payment_sum_recorded}}
{% trans 'Deductions' %}{{report.intervention_report.deduction_sum}}{{report.intervention_report.deduction_sum_checked}}{{report.intervention_report.deduction_sum_recorded}}
+
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/intervention/laws.html b/analysis/templates/analysis/reports/includes/intervention/laws.html new file mode 100644 index 00000000..d373c681 --- /dev/null +++ b/analysis/templates/analysis/reports/includes/intervention/laws.html @@ -0,0 +1,50 @@ +{% load i18n fontawesome_5 %} +

{% trans 'Law usage' %}

+ + {% blocktrans %} + Please note: One intervention can be based on multiple laws. This table therefore does not + count + {% endblocktrans %} + +
+ + + + + + + + + + + {% for law in report.intervention_report.evaluated_laws %} + + + + + + + {% endfor %} + + + + + + + +
+ {% trans 'Law' %} + + {% trans 'Checked' %} + + {% trans 'Recorded' %} + + {% trans 'Total' %} +
+ {{law.short_name}} +
+ + {{law.long_name}} + +
{{law.num_checked}}{{law.num_recorded}}{{law.num}}
{% trans 'Total' %}{{report.intervention_report.law_sum_checked}}{{report.intervention_report.law_sum_recorded}}{{report.intervention_report.law_sum}}
+
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/index.html b/analysis/templates/analysis/reports/index.html new file mode 100644 index 00000000..4f7d8bd0 --- /dev/null +++ b/analysis/templates/analysis/reports/index.html @@ -0,0 +1,8 @@ +{% extends 'base.html' %} +{% load i18n fontawesome_5 %} + +{% block body %} +
+

{% trans 'Reports' %}

+
+{% endblock %} \ No newline at end of file diff --git a/analysis/tests.py b/analysis/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/analysis/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/analysis/urls.py b/analysis/urls.py new file mode 100644 index 00000000..71eb6665 --- /dev/null +++ b/analysis/urls.py @@ -0,0 +1,15 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: michel.peltriaux@sgdnord.rlp.de +Created on: 15.10.21 + +""" +from django.urls import path +from analysis.views import * + +app_name = "analysis" +urlpatterns = [ + path("reports/", index_reports_view, name="reports"), + path("reports/", detail_report_view, name="report-detail"), +] \ No newline at end of file diff --git a/analysis/utils/report.py b/analysis/utils/report.py new file mode 100644 index 00000000..fbc88520 --- /dev/null +++ b/analysis/utils/report.py @@ -0,0 +1,127 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: michel.peltriaux@sgdnord.rlp.de +Created on: 18.10.21 + +""" +from django.db.models import Count, Sum, Q + +from codelist.models import KonovaCode +from codelist.settings import CODELIST_LAW_ID +from compensation.models import Compensation, Payment, EcoAccountDeduction +from intervention.models import Intervention + + +class TimespanReport: + office_id = -1 + + class InterventionReport: + queryset = Intervention.objects.none() + queryset_checked = Intervention.objects.none() + queryset_recorded = Intervention.objects.none() + + # Law related + law_sum = -1 + law_sum_checked = -1 + law_sum_recorded = -1 + evaluated_laws = None + + # Compensations related + compensation_sum = -1 + compensation_sum_checked = -1 + compensation_sum_recorded = -1 + payment_sum = -1 + payment_sum_checked = -1 + payment_sum_recorded = -1 + deduction_sum = -1 + deduction_sum_checked = -1 + deduction_sum_recorded = -1 + + def __init__(self, id: str): + self.queryset = Intervention.objects.filter( + responsible__conservation_office__id=id, + deleted=None, + ) + self.queryset_checked = self.queryset.filter( + checked__isnull=False + ) + self.queryset_recorded = self.queryset.filter( + recorded__isnull=False + ) + self._create_report() + + def _create_report(self): + """ Creates all report information + + Returns: + + """ + self._evaluate_laws() + self._evaluate_compensations() + + def _evaluate_laws(self): + """ Analyzes the intervention-law distribution + + Returns: + + """ + # Count interventions based on law + # Fetch all KonovaCodes for laws, sorted alphabetically + laws = KonovaCode.objects.filter( + is_archived=False, + is_leaf=True, + code_lists__in=[CODELIST_LAW_ID], + ).order_by( + "long_name" + ) + # Fetch all law ids which are used by any .legal object of an intervention object + intervention_laws_total = self.queryset.values_list("legal__laws__id") + intervention_laws_checked = self.queryset.filter(checked__isnull=False).values_list("legal__laws__id") + intervention_laws_recorded = self.queryset.filter(recorded__isnull=False).values_list( + "legal__laws__id") + # Count how often which law id appears in the above list, return only the long_name of the law and the resulting + # count (here 'num'). This is for keeping the db fetch as small as possible + # Compute the sum for total, checked and recorded + self.evaluated_laws = laws.annotate( + num=Count("id", filter=Q(id__in=intervention_laws_total)), + num_checked=Count("id", filter=Q(id__in=intervention_laws_checked)), + num_recorded=Count("id", filter=Q(id__in=intervention_laws_recorded)), + ).values_list("short_name", "long_name", "num_checked", "num_recorded", "num", named=True) + self.law_sum = self.evaluated_laws.aggregate(sum_num=Sum("num"))["sum_num"] + self.law_sum_checked = self.evaluated_laws.aggregate(sum_num_checked=Sum("num_checked"))["sum_num_checked"] + self.law_sum_recorded = self.evaluated_laws.aggregate(sum_num_recorded=Sum("num_recorded"))["sum_num_recorded"] + + def _evaluate_compensations(self): + """ Analyzes the types of compensation distribution + + Returns: + + """ + # Count all compensations + comps = Compensation.objects.filter( + intervention__in=self.queryset + ) + self.compensation_sum = comps.count() + self.compensation_sum_checked = comps.filter(intervention__checked__isnull=False).count() + self.compensation_sum_recorded = comps.filter(intervention__recorded__isnull=False).count() + + # Count all payments + payments = Payment.objects.filter( + intervention__in=self.queryset + ) + self.payment_sum = payments.count() + self.payment_sum_checked = payments.filter(intervention__checked__isnull=False).count() + self.payment_sum_recorded = payments.filter(intervention__recorded__isnull=False).count() + + # Count all deductions + deductions = EcoAccountDeduction.objects.filter( + intervention__in=self.queryset + ) + self.deduction_sum = deductions.count() + self.deduction_sum_checked = deductions.filter(intervention__checked__isnull=False).count() + self.deduction_sum_recorded = deductions.filter(intervention__recorded__isnull=False).count() + + def __init__(self, office_id: str): + self.office_id = office_id + self.intervention_report = self.InterventionReport(self.office_id) diff --git a/analysis/views.py b/analysis/views.py new file mode 100644 index 00000000..43dd061b --- /dev/null +++ b/analysis/views.py @@ -0,0 +1,59 @@ +from django.contrib.auth.decorators import login_required +from django.db.models import Count, Q, Sum +from django.http import HttpRequest +from django.shortcuts import render, get_object_or_404 + +from analysis.utils.report import TimespanReport +from codelist.models import KonovaCode +from codelist.settings import CODELIST_LAW_ID +from compensation.models import EcoAccount, Compensation +from ema.models import Ema +from intervention.models import Intervention +from konova.contexts import BaseContext +from konova.decorators import conservation_office_group_required + + +@login_required +@conservation_office_group_required +def index_reports_view(request: HttpRequest): + """ + + Args: + request (HttpRequest): The incoming request + + Returns: + + """ + template = "analysis/reports/index.html" + context = {} + context = BaseContext(request, context).context + return render(request, template, context) + + +def detail_report_view(request: HttpRequest, id: str): + cons_office = get_object_or_404( + KonovaCode, + id=id, + ) + cons_interventions = Intervention.objects.filter( + responsible__conservation_office__id=id, + deleted=None, + ) + cons_comps = Compensation.objects.filter( + intervention__in=cons_interventions, + deleted=None, + ) + cons_eco_account = EcoAccount.objects.filter( + responsible__conservation_office__id=id, + deleted=None, + ) + + report = TimespanReport(id) + + template = "analysis/reports/detail.html" + context = { + "office": cons_office, + "report": report, + } + context = BaseContext(request, context).context + return render(request, template, context) \ No newline at end of file diff --git a/konova/sub_settings/django_settings.py b/konova/sub_settings/django_settings.py index 29540d4b..df875a81 100644 --- a/konova/sub_settings/django_settings.py +++ b/konova/sub_settings/django_settings.py @@ -69,6 +69,7 @@ INSTALLED_APPS = [ 'user', 'ema', 'codelist', + 'analysis', ] if DEBUG: INSTALLED_APPS += [ diff --git a/konova/urls.py b/konova/urls.py index 8448cb4e..1aebcbcc 100644 --- a/konova/urls.py +++ b/konova/urls.py @@ -36,7 +36,8 @@ urlpatterns = [ path('ema/', include("ema.urls")), path('user/', include("user.urls")), path('news/', include("news.urls")), - path('news/', include("codelist.urls")), + path('cl/', include("codelist.urls")), + path('analysis/', include("analysis.urls")), # Generic deadline routes path('deadline//remove', remove_deadline_view, name="deadline-remove"), diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index b9d3ebde2f32b322b31bbe5e82f547e9e9e5b976..c65e66dc01cf89f3565d996215b6934dfe6b7363 100644 GIT binary patch delta 8283 zcmZ|U3w+P@9>?+T>|%ChHn$BkZ8nQth%v@Y<~GcoQD**Z;y<>DRDRWQsYH$uxnGi! z6E)F=P8WrQL{TwE7fLBzbvvi?dhhpj^62q6zw`L?{C>Z`@9%s0e1E?`osPWfb9%pz zQyt;A+;Elq7!!lLf{po}a{q>EHKtK>W5TI7#!Bi*vBu2DeK;3;wlJnC9>NH`X#Euf zsE5WG!;mHtLogP@u#Kx@y4Vi=uq8J}*baAMB=rZeF0RLVxYO2O!*J>+us(i*>VFkA zK?s9s!e~@I(b^G1srSNQ;}|oPf>u5b6R;e8aTRI@>rex1K~1;|HSm7a#K&#@Gt|J} zVI4F#xC;(KjT3`G*b+5gTMS`-ldS>{Ky@s@HaH&Hj9G%3xC(3I>(~kpV`KatmEzEN zcR`J$Q?C(#{f7&f6k0c)d!8eoB~FUCOXk672E zGW7&%AuppAa0K<-Db)DYs0pv2j>;stM-k#s&`uhoQr*hl$U=RN{ZMCBjGE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OLnKvsJ!ISE(1#TcR5$7WM}R{-;!m$PE{y* Ow(q*2lH_6W75@i-DK3Ek diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index aebd7445..f02eced3 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-14 09:12+0200\n" +"POT-Creation-Date: 2021-10-18 14:59+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -29,12 +29,111 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#: analysis/templates/analysis/reports/detail.html:7 +#: compensation/templates/compensation/report/compensation/report.html:7 +#: compensation/templates/compensation/report/eco_account/report.html:7 +#: ema/templates/ema/report/report.html:7 +#: intervention/templates/intervention/report/report.html:7 +msgid "Report" +msgstr "Bericht" + +#: analysis/templates/analysis/reports/includes/card_compensation.html:11 +#: compensation/tables.py:62 +#: intervention/templates/intervention/detail/includes/compensations.html:8 +#: intervention/templates/intervention/report/report.html:49 +msgid "Compensations" +msgstr "Kompensationen" + +#: analysis/templates/analysis/reports/includes/card_eco_account.html:11 +msgid "Eco-Accounts" +msgstr "Ökokonten" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:10 +#: intervention/tables.py:66 +msgid "Interventions" +msgstr "Eingriffe" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:17 +msgid "Total interventions" +msgstr "Insgesamt" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:22 +msgid "Amount total" +msgstr "Anzahl insgesamt" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:26 +msgid "Amount checked" +msgstr "Anzahl geprüft" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:30 +msgid "Amount recorded" +msgstr "Anzahl verzeichnet" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:37 +msgid "Law usage" +msgstr "Gesetzesanwendungen" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:43 +#: intervention/forms/forms.py:68 +#: intervention/templates/intervention/detail/view.html:39 +#: intervention/templates/intervention/report/report.html:20 +msgid "Law" +msgstr "Gesetz" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:46 +#: compensation/tables.py:35 +#: compensation/templates/compensation/detail/compensation/view.html:43 +#: intervention/tables.py:33 +#: intervention/templates/intervention/detail/view.html:68 user/models.py:48 +msgid "Checked" +msgstr "Geprüft" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:49 +#: compensation/tables.py:41 compensation/tables.py:181 +#: compensation/templates/compensation/detail/compensation/view.html:57 +#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31 +#: compensation/templates/compensation/detail/eco_account/view.html:44 +#: ema/tables.py:38 ema/templates/ema/detail/view.html:28 +#: intervention/tables.py:39 +#: intervention/templates/intervention/detail/view.html:82 user/models.py:49 +msgid "Recorded" +msgstr "Verzeichnet" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:52 +#: analysis/templates/analysis/reports/includes/card_intervention.html:72 +#: konova/templates/konova/home.html:23 konova/templates/konova/home.html:61 +#: konova/templates/konova/home.html:100 +msgid "Total" +msgstr "Insgesamt" + +#: analysis/templates/analysis/reports/includes/card_intervention.html:81 +msgid "" +"\n" +" Please note: One intervention can be based on " +"multiple laws. This table therefore does not\n" +" count\n" +" " +msgstr "" + +#: analysis/templates/analysis/reports/includes/card_old_interventions.html:11 +msgid "Old interventions" +msgstr "Altfälle" + +#: analysis/templates/analysis/reports/includes/card_old_interventions.html:13 +msgid "Before" +msgstr "Vor" + +#: analysis/templates/analysis/reports/index.html:6 +#: templates/navbars/navbar.html:46 +msgid "Reports" +msgstr "Berichte" + #: compensation/filters.py:70 msgid "Show only unrecorded" msgstr "Nur unverzeichnete anzeigen" #: compensation/forms/forms.py:31 compensation/tables.py:25 -#: compensation/tables.py:167 ema/tables.py:28 intervention/forms/forms.py:27 +#: compensation/tables.py:166 ema/tables.py:28 intervention/forms/forms.py:27 #: intervention/tables.py:23 #: intervention/templates/intervention/detail/includes/compensations.html:30 msgid "Identifier" @@ -45,7 +144,7 @@ msgid "Generated automatically" msgstr "Automatisch generiert" #: compensation/forms/forms.py:43 compensation/tables.py:30 -#: compensation/tables.py:172 +#: compensation/tables.py:171 #: compensation/templates/compensation/detail/compensation/includes/documents.html:28 #: compensation/templates/compensation/detail/compensation/view.html:31 #: compensation/templates/compensation/detail/eco_account/includes/documents.html:28 @@ -308,12 +407,12 @@ msgstr "Maßnahmentyp wählen" #: compensation/templates/compensation/detail/compensation/includes/documents.html:35 #: compensation/templates/compensation/detail/compensation/includes/states-after.html:40 #: compensation/templates/compensation/detail/compensation/includes/states-before.html:40 -#: compensation/templates/compensation/detail/eco_account/includes/actions.html:37 +#: compensation/templates/compensation/detail/eco_account/includes/actions.html:38 #: compensation/templates/compensation/detail/eco_account/includes/deadlines.html:37 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:40 #: compensation/templates/compensation/detail/eco_account/includes/documents.html:34 -#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:39 -#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:39 +#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:40 +#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:40 #: ema/templates/ema/detail/includes/actions.html:37 #: ema/templates/ema/detail/includes/deadlines.html:37 #: ema/templates/ema/detail/includes/documents.html:34 @@ -358,38 +457,38 @@ msgstr "Geben Sie die Daten der neuen Maßnahme ein" msgid "Added action" msgstr "Maßnahme hinzugefügt" -#: compensation/models.py:78 +#: compensation/models.py:82 msgid "cm" msgstr "" -#: compensation/models.py:79 +#: compensation/models.py:83 msgid "m" msgstr "" -#: compensation/models.py:80 +#: compensation/models.py:84 msgid "km" msgstr "" -#: compensation/models.py:81 +#: compensation/models.py:85 msgid "m²" msgstr "" -#: compensation/models.py:82 +#: compensation/models.py:86 msgid "ha" msgstr "" -#: compensation/models.py:83 +#: compensation/models.py:87 msgid "Pieces" msgstr "Stück" -#: compensation/models.py:311 +#: compensation/models.py:321 msgid "" "Deductable surface can not be larger than existing surfaces in after states" msgstr "" "Die abbuchbare Fläche darf die Gesamtfläche der Zielzustände nicht " "überschreiten" -#: compensation/models.py:318 +#: compensation/models.py:328 msgid "" "Deductable surface can not be smaller than the sum of already existing " "deductions. Please contact the responsible users for the deductions!" @@ -397,40 +496,17 @@ msgstr "" "Es wurde bereits mehr Fläche abgebucht, als Sie nun als abbuchbar einstellen " "wollen. Kontaktieren Sie die für die Abbuchungen verantwortlichen Nutzer!" -#: compensation/tables.py:35 -#: compensation/templates/compensation/detail/compensation/view.html:43 -#: intervention/tables.py:33 -#: intervention/templates/intervention/detail/view.html:68 user/models.py:48 -msgid "Checked" -msgstr "Geprüft" - -#: compensation/tables.py:41 compensation/tables.py:182 -#: compensation/templates/compensation/detail/compensation/view.html:57 -#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31 -#: compensation/templates/compensation/detail/eco_account/view.html:44 -#: ema/tables.py:38 ema/templates/ema/detail/view.html:28 -#: intervention/tables.py:39 -#: intervention/templates/intervention/detail/view.html:82 user/models.py:49 -msgid "Recorded" -msgstr "Verzeichnet" - -#: compensation/tables.py:47 compensation/tables.py:188 ema/tables.py:44 +#: compensation/tables.py:47 compensation/tables.py:187 ema/tables.py:44 #: intervention/tables.py:51 msgid "Editable" msgstr "Freigegeben" -#: compensation/tables.py:53 compensation/tables.py:194 ema/tables.py:50 +#: compensation/tables.py:53 compensation/tables.py:193 ema/tables.py:50 #: intervention/tables.py:57 msgid "Last edit" msgstr "Zuletzt bearbeitet" -#: compensation/tables.py:62 -#: intervention/templates/intervention/detail/includes/compensations.html:8 -#: intervention/templates/intervention/report/report.html:49 -msgid "Compensations" -msgstr "Kompensationen" - -#: compensation/tables.py:84 compensation/tables.py:225 ema/tables.py:82 +#: compensation/tables.py:84 compensation/tables.py:224 ema/tables.py:82 #: intervention/tables.py:88 msgid "Open {}" msgstr "Öffne {}" @@ -451,46 +527,47 @@ msgstr "Am {} von {} geprüft worden" #: compensation/tables.py:129 #: compensation/templates/compensation/detail/compensation/view.html:60 +#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:56 #: compensation/templates/compensation/detail/eco_account/view.html:47 #: ema/tables.py:101 ema/templates/ema/detail/view.html:31 -#: intervention/models.py:384 intervention/tables.py:131 +#: intervention/tables.py:131 #: intervention/templates/intervention/detail/view.html:85 msgid "Not recorded yet" msgstr "Noch nicht verzeichnet" -#: compensation/tables.py:134 compensation/tables.py:263 ema/tables.py:106 -#: intervention/models.py:389 intervention/tables.py:136 +#: compensation/tables.py:134 compensation/tables.py:262 ema/tables.py:106 +#: intervention/tables.py:136 msgid "Recorded on {} by {}" msgstr "Am {} von {} verzeichnet worden" -#: compensation/tables.py:159 compensation/tables.py:286 ema/tables.py:129 +#: compensation/tables.py:158 compensation/tables.py:284 ema/tables.py:129 #: intervention/tables.py:159 msgid "Full access granted" msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden" -#: compensation/tables.py:159 compensation/tables.py:286 ema/tables.py:129 +#: compensation/tables.py:158 compensation/tables.py:284 ema/tables.py:129 #: intervention/tables.py:159 msgid "Access not granted" msgstr "Nicht freigegeben - Datensatz nur lesbar" -#: compensation/tables.py:177 +#: compensation/tables.py:176 #: compensation/templates/compensation/detail/eco_account/view.html:35 #: konova/templates/konova/widgets/progressbar.html:3 msgid "Available" msgstr "Verfügbar" -#: compensation/tables.py:203 +#: compensation/tables.py:202 msgid "Eco Accounts" msgstr "Ökokonten" -#: compensation/tables.py:225 +#: compensation/tables.py:224 #: compensation/templates/compensation/detail/eco_account/view.html:19 #: intervention/forms/modalForms.py:258 intervention/forms/modalForms.py:265 #: konova/templates/konova/home.html:88 templates/navbars/navbar.html:34 msgid "Eco-account" msgstr "Ökokonto" -#: compensation/tables.py:258 +#: compensation/tables.py:257 msgid "Not recorded yet. Can not be used for deductions, yet." msgstr "" "Noch nicht verzeichnet. Kann noch nicht für Abbuchungen genutzt werden." @@ -522,7 +599,7 @@ msgid "Amount" msgstr "Menge" #: compensation/templates/compensation/detail/compensation/includes/actions.html:53 -#: compensation/templates/compensation/detail/eco_account/includes/actions.html:51 +#: compensation/templates/compensation/detail/eco_account/includes/actions.html:53 #: ema/templates/ema/detail/includes/actions.html:51 msgid "Remove action" msgstr "Maßnahme entfernen" @@ -638,8 +715,8 @@ msgstr "Biotoptyp" #: compensation/templates/compensation/detail/compensation/includes/states-after.html:54 #: compensation/templates/compensation/detail/compensation/includes/states-before.html:54 -#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:52 -#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:52 +#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:54 +#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:54 #: ema/templates/ema/detail/includes/states-after.html:52 #: ema/templates/ema/detail/includes/states-before.html:52 msgid "Remove state" @@ -670,6 +747,7 @@ msgstr "Geprüft am " #: compensation/templates/compensation/detail/compensation/view.html:50 #: compensation/templates/compensation/detail/compensation/view.html:64 +#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:54 #: compensation/templates/compensation/detail/eco_account/view.html:51 #: ema/templates/ema/detail/view.html:35 #: intervention/templates/intervention/detail/view.html:75 @@ -755,6 +833,12 @@ msgstr "Eingriffskennung" msgid "Created" msgstr "Erstellt" +#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:54 +#, fuzzy +#| msgid "Recorded on " +msgid "Recorded on" +msgstr "Verzeichnet am" + #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:63 #: intervention/templates/intervention/detail/includes/deductions.html:58 msgid "Remove Deduction" @@ -789,24 +873,17 @@ msgstr "Fehlt" msgid "Action handler" msgstr "Maßnahmenträger" -#: compensation/templates/compensation/report/compensation/report.html:7 -#: compensation/templates/compensation/report/eco_account/report.html:7 -#: ema/templates/ema/report/report.html:7 -#: intervention/templates/intervention/report/report.html:7 -msgid "Report" -msgstr "Bericht" - -#: compensation/templates/compensation/report/compensation/report.html:58 -#: compensation/templates/compensation/report/eco_account/report.html:75 -#: ema/templates/ema/report/report.html:62 -#: intervention/templates/intervention/report/report.html:108 +#: compensation/templates/compensation/report/compensation/report.html:55 +#: compensation/templates/compensation/report/eco_account/report.html:72 +#: ema/templates/ema/report/report.html:59 +#: intervention/templates/intervention/report/report.html:105 msgid "Open in browser" msgstr "Im Browser öffnen" -#: compensation/templates/compensation/report/compensation/report.html:62 -#: compensation/templates/compensation/report/eco_account/report.html:79 -#: ema/templates/ema/report/report.html:66 -#: intervention/templates/intervention/report/report.html:112 +#: compensation/templates/compensation/report/compensation/report.html:59 +#: compensation/templates/compensation/report/eco_account/report.html:76 +#: ema/templates/ema/report/report.html:63 +#: intervention/templates/intervention/report/report.html:109 msgid "View in LANIS" msgstr "In LANIS öffnen" @@ -823,8 +900,8 @@ msgid "Compensation {} edited" msgstr "Kompensation {} bearbeitet" #: compensation/views/compensation_views.py:213 -#: compensation/views/eco_account_views.py:278 ema/views.py:175 -#: intervention/views.py:428 +#: compensation/views/eco_account_views.py:287 ema/views.py:175 +#: intervention/views.py:437 msgid "Log" msgstr "Log" @@ -833,23 +910,23 @@ msgid "Compensation removed" msgstr "Kompensation entfernt" #: compensation/views/compensation_views.py:253 -#: compensation/views/eco_account_views.py:377 ema/views.py:328 -#: intervention/views.py:124 +#: compensation/views/eco_account_views.py:386 ema/views.py:328 +#: intervention/views.py:126 msgid "Document added" msgstr "Dokument hinzugefügt" #: compensation/views/compensation_views.py:309 -#: compensation/views/eco_account_views.py:321 ema/views.py:272 +#: compensation/views/eco_account_views.py:330 ema/views.py:272 msgid "State added" msgstr "Zustand hinzugefügt" #: compensation/views/compensation_views.py:328 -#: compensation/views/eco_account_views.py:340 ema/views.py:291 +#: compensation/views/eco_account_views.py:349 ema/views.py:291 msgid "Action added" msgstr "Maßnahme hinzugefügt" #: compensation/views/compensation_views.py:347 -#: compensation/views/eco_account_views.py:359 ema/views.py:310 +#: compensation/views/eco_account_views.py:368 ema/views.py:310 msgid "Deadline added" msgstr "Frist/Termin hinzugefügt" @@ -861,33 +938,33 @@ msgstr "Zustand gelöscht" msgid "Action removed" msgstr "Maßnahme entfernt" -#: compensation/views/eco_account_views.py:87 +#: compensation/views/eco_account_views.py:86 msgid "Eco-Account {} added" msgstr "Ökokonto {} hinzugefügt" -#: compensation/views/eco_account_views.py:142 +#: compensation/views/eco_account_views.py:141 msgid "Eco-Account {} edited" msgstr "Ökokonto {} bearbeitet" -#: compensation/views/eco_account_views.py:228 +#: compensation/views/eco_account_views.py:237 msgid "Eco-account removed" msgstr "Ökokonto entfernt" -#: compensation/views/eco_account_views.py:255 +#: compensation/views/eco_account_views.py:264 msgid "Deduction removed" msgstr "Abbuchung entfernt" -#: compensation/views/eco_account_views.py:298 ema/views.py:249 -#: intervention/views.py:468 +#: compensation/views/eco_account_views.py:307 ema/views.py:249 +#: intervention/views.py:477 msgid "{} unrecorded" msgstr "{} entzeichnet" -#: compensation/views/eco_account_views.py:298 ema/views.py:249 -#: intervention/views.py:468 +#: compensation/views/eco_account_views.py:307 ema/views.py:249 +#: intervention/views.py:477 msgid "{} recorded" msgstr "{} verzeichnet" -#: compensation/views/eco_account_views.py:434 intervention/views.py:450 +#: compensation/views/eco_account_views.py:443 intervention/views.py:459 msgid "Deduction added" msgstr "Abbuchung hinzugefügt" @@ -965,12 +1042,6 @@ msgstr "Bauvorhaben XY; Flur ABC" msgid "Process type" msgstr "Verfahrenstyp" -#: intervention/forms/forms.py:68 -#: intervention/templates/intervention/detail/view.html:39 -#: intervention/templates/intervention/report/report.html:20 -msgid "Law" -msgstr "Gesetz" - #: intervention/forms/forms.py:70 msgid "Multiple selection possible" msgstr "Mehrfachauswahl möglich" @@ -1120,31 +1191,31 @@ msgstr "" "Das Ökokonto {} hat für eine Abbuchung von {} m² nicht ausreichend " "Restfläche. Es stehen noch {} m² zur Verfügung." -#: intervention/models.py:324 +#: intervention/models.py:329 msgid "Registration office file number missing" msgstr "Aktenzeichen Zulassungsbehörde fehlt" -#: intervention/models.py:327 +#: intervention/models.py:332 msgid "Conservation office file number missing" msgstr "Aktenzeichen Naturschutzbehörde fehlt" -#: intervention/models.py:330 +#: intervention/models.py:335 msgid "Responsible data missing" msgstr "Daten zu Verantwortlichen fehlen" -#: intervention/models.py:344 +#: intervention/models.py:349 msgid "Revocation exists" msgstr "Widerspruch liegt vor" -#: intervention/models.py:347 +#: intervention/models.py:352 msgid "Registration date missing" msgstr "Datum Zulassung bzw. Satzungsbeschluss fehlt" -#: intervention/models.py:350 +#: intervention/models.py:355 msgid "Binding on missing" msgstr "Datum Bestandskraft fehlt" -#: intervention/models.py:352 +#: intervention/models.py:357 msgid "Legal data missing" msgstr "Rechtliche Daten fehlen" @@ -1155,10 +1226,6 @@ msgstr "Rechtliche Daten fehlen" msgid "Revocation" msgstr "Widerspruch" -#: intervention/tables.py:66 -msgid "Interventions" -msgstr "Eingriffe" - #: intervention/tables.py:176 msgid "No revocation" msgstr "Kein Widerspruch" @@ -1226,15 +1293,15 @@ msgstr "Abbuchungen von Ökokonten" msgid "Exist" msgstr "Vorhanden" -#: intervention/views.py:77 +#: intervention/views.py:79 msgid "Intervention {} added" msgstr "Eingriff {} hinzugefügt" -#: intervention/views.py:212 +#: intervention/views.py:221 msgid "This intervention has a revocation from {}" msgstr "Es existiert ein Widerspruch vom {}" -#: intervention/views.py:228 +#: intervention/views.py:237 msgid "" "Remember: This data has not been shared with you, yet. This means you can " "only read but can not edit or perform any actions like running a check or " @@ -1244,43 +1311,43 @@ msgstr "" "bedeutet, dass Sie nur lesenden Zugriff hierauf haben und weder bearbeiten, " "noch Prüfungen durchführen oder verzeichnen können." -#: intervention/views.py:255 +#: intervention/views.py:264 msgid "Intervention {} edited" msgstr "Eingriff {} bearbeitet" -#: intervention/views.py:287 +#: intervention/views.py:296 msgid "{} removed" msgstr "{} entfernt" -#: intervention/views.py:308 +#: intervention/views.py:317 msgid "Revocation removed" msgstr "Widerspruch entfernt" -#: intervention/views.py:334 +#: intervention/views.py:343 msgid "{} has already been shared with you" msgstr "{} wurde bereits für Sie freigegeben" -#: intervention/views.py:339 +#: intervention/views.py:348 msgid "{} has been shared with you" msgstr "{} ist nun für Sie freigegeben" -#: intervention/views.py:346 +#: intervention/views.py:355 msgid "Share link invalid" msgstr "Freigabelink ungültig" -#: intervention/views.py:367 +#: intervention/views.py:376 msgid "Share settings updated" msgstr "Freigabe Einstellungen aktualisiert" -#: intervention/views.py:386 +#: intervention/views.py:395 msgid "Check performed" msgstr "Prüfung durchgeführt" -#: intervention/views.py:406 +#: intervention/views.py:415 msgid "Revocation added" msgstr "Widerspruch hinzugefügt" -#: intervention/views.py:473 +#: intervention/views.py:482 msgid "There are errors on this intervention:" msgstr "Es liegen Fehler in diesem Eingriff vor:" @@ -1403,10 +1470,13 @@ msgstr "Kontrolle am" msgid "Other" msgstr "Sonstige" -#: konova/templates/konova/home.html:23 konova/templates/konova/home.html:61 -#: konova/templates/konova/home.html:100 -msgid "Total" -msgstr "Insgesamt" +#: konova/sub_settings/django_settings.py:154 +msgid "German" +msgstr "" + +#: konova/sub_settings/django_settings.py:155 +msgid "English" +msgstr "" #: konova/templates/konova/home.html:27 konova/templates/konova/home.html:65 #: konova/templates/konova/home.html:104 @@ -1634,10 +1704,6 @@ msgstr "" msgid "Export..." msgstr "" -#: templates/navbars/navbar.html:46 -msgid "Reports" -msgstr "Berichte" - #: templates/navbars/navbar.html:58 user/templates/user/index.html:31 msgid "Settings" msgstr "Einstellungen" @@ -2980,9 +3046,6 @@ msgstr "" #~ msgid "Transfer comment" #~ msgstr "Verwendungszweck" -#~ msgid "EMA recorded" -#~ msgstr "EMA verzeichnet" - #~ msgid "Edit {}" #~ msgstr "Bearbeite {}" diff --git a/templates/navbars/navbar.html b/templates/navbars/navbar.html index 39b622e1..46a274ff 100644 --- a/templates/navbars/navbar.html +++ b/templates/navbars/navbar.html @@ -43,7 +43,7 @@ {% fa5_icon 'euro-sign' %} {% trans 'EMA' %} {% fa5_icon 'file-import' %} {% trans 'Import...' %} {% fa5_icon 'file-export' %} {% trans 'Export...' %} - {% fa5_icon 'file-alt' %} {% trans 'Reports' %} + {% fa5_icon 'file-alt' %} {% trans 'Reports' %} -- 2.45.2 From 33de71d5543e772b8c1903adc1e5701679deb81e Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Tue, 19 Oct 2021 09:13:20 +0200 Subject: [PATCH 02/14] #26 Annual conservation report * adds new templatetag default_if_zero in ksp_filters.py * adds/updates translations --- .../reports/includes/intervention/amount.html | 8 +- .../intervention/card_intervention.html | 4 +- .../includes/intervention/compensated_by.html | 20 +- .../reports/includes/intervention/laws.html | 14 +- konova/templatetags/ksp_filters.py | 16 ++ locale/de/LC_MESSAGES/django.mo | Bin 25176 -> 25882 bytes locale/de/LC_MESSAGES/django.po | 178 +++++++++++------- 7 files changed, 148 insertions(+), 92 deletions(-) diff --git a/analysis/templates/analysis/reports/includes/intervention/amount.html b/analysis/templates/analysis/reports/includes/intervention/amount.html index a146d4b2..8ecbe018 100644 --- a/analysis/templates/analysis/reports/includes/intervention/amount.html +++ b/analysis/templates/analysis/reports/includes/intervention/amount.html @@ -1,4 +1,4 @@ -{% load i18n fontawesome_5 %} +{% load i18n fontawesome_5 ksp_filters %}

{% trans 'Amount' %}

@@ -21,9 +21,9 @@ - {{report.intervention_report.queryset.count}} - {{report.intervention_report.queryset_checked.count}} - {{report.intervention_report.queryset_recorded.count}} + {{report.intervention_report.queryset.count|default_if_zero:"-"}} + {{report.intervention_report.queryset_checked.count|default_if_zero:"-"}} + {{report.intervention_report.queryset_recorded.count|default_if_zero:"-"}} diff --git a/analysis/templates/analysis/reports/includes/intervention/card_intervention.html b/analysis/templates/analysis/reports/includes/intervention/card_intervention.html index 13c22892..6a9993a3 100644 --- a/analysis/templates/analysis/reports/includes/intervention/card_intervention.html +++ b/analysis/templates/analysis/reports/includes/intervention/card_intervention.html @@ -16,9 +16,9 @@
{% include 'analysis/reports/includes/intervention/amount.html' %}
- {% include 'analysis/reports/includes/intervention/laws.html' %} -
{% include 'analysis/reports/includes/intervention/compensated_by.html' %} +
+ {% include 'analysis/reports/includes/intervention/laws.html' %}
diff --git a/analysis/templates/analysis/reports/includes/intervention/compensated_by.html b/analysis/templates/analysis/reports/includes/intervention/compensated_by.html index 87dfc570..8608f113 100644 --- a/analysis/templates/analysis/reports/includes/intervention/compensated_by.html +++ b/analysis/templates/analysis/reports/includes/intervention/compensated_by.html @@ -1,4 +1,4 @@ -{% load i18n fontawesome_5 %} +{% load i18n fontawesome_5 ksp_filters %}

{% trans 'Compensated by' %}

@@ -13,21 +13,21 @@ - - - + + + - - - + + + - - - + + +
{% trans 'Compensation' %}{{report.intervention_report.compensation_sum}}{{report.intervention_report.compensation_sum_checked}}{{report.intervention_report.compensation_sum_recorded}}{{report.intervention_report.compensation_sum|default_if_zero:"-"}}{{report.intervention_report.compensation_sum_checked|default_if_zero:"-"}}{{report.intervention_report.compensation_sum_recorded|default_if_zero:"-"}}
{% trans 'Payment' %}{{report.intervention_report.payment_sum}}{{report.intervention_report.payment_sum_checked}}{{report.intervention_report.payment_sum_recorded}}{{report.intervention_report.payment_sum|default_if_zero:"-"}}{{report.intervention_report.payment_sum_checked|default_if_zero:"-"}}{{report.intervention_report.payment_sum_recorded|default_if_zero:"-"}}
{% trans 'Deductions' %}{{report.intervention_report.deduction_sum}}{{report.intervention_report.deduction_sum_checked}}{{report.intervention_report.deduction_sum_recorded}}{{report.intervention_report.deduction_sum|default_if_zero:"-"}}{{report.intervention_report.deduction_sum_checked|default_if_zero:"-"}}{{report.intervention_report.deduction_sum_recorded|default_if_zero:"-"}}
diff --git a/analysis/templates/analysis/reports/includes/intervention/laws.html b/analysis/templates/analysis/reports/includes/intervention/laws.html index d373c681..8e04341c 100644 --- a/analysis/templates/analysis/reports/includes/intervention/laws.html +++ b/analysis/templates/analysis/reports/includes/intervention/laws.html @@ -1,4 +1,4 @@ -{% load i18n fontawesome_5 %} +{% load i18n fontawesome_5 ksp_filters %}

{% trans 'Law usage' %}

{% blocktrans %} @@ -34,16 +34,16 @@ {{law.long_name}} - {{law.num_checked}} - {{law.num_recorded}} - {{law.num}} + {{law.num_checked|default_if_zero:"-"}} + {{law.num_recorded|default_if_zero:"-"}} + {{law.num|default_if_zero:"-"}} {% endfor %} {% trans 'Total' %} - {{report.intervention_report.law_sum_checked}} - {{report.intervention_report.law_sum_recorded}} - {{report.intervention_report.law_sum}} + {{report.intervention_report.law_sum_checked|default_if_zero:"-"}} + {{report.intervention_report.law_sum_recorded|default_if_zero:"-"}} + {{report.intervention_report.law_sum|default_if_zero:"-"}} diff --git a/konova/templatetags/ksp_filters.py b/konova/templatetags/ksp_filters.py index 95fc7ea0..1472d503 100644 --- a/konova/templatetags/ksp_filters.py +++ b/konova/templatetags/ksp_filters.py @@ -34,3 +34,19 @@ def bootstrap_cls(value): """ return SVI_BOOTSTRAP_CLS_MAP.get(value, "") + + +@register.filter("default_if_zero") +def default_if_zero(val1, val2): + """ Returns val2 if val1 is 0 + + Similar to default_if_none + + Args: + val1 (int): The numerical value + val2 (str): The alternative + + Returns: + + """ + return val1 if val1 > 0 else val2 diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index c65e66dc01cf89f3565d996215b6934dfe6b7363..9b21d9f7b429469e5694404e04790d94dbaa2e39 100644 GIT binary patch delta 8850 zcmZwM2Y3}#-pBDtffPCf5Gk3!1_*>u1R)RzO=@T%1f}03ljK6UH{5$eOx*RlD58kv zl_H28u(1e|6${9gASjA$6@gU{VJ!=&?4qEEyx-rQ6Q4Zq^UmWxpL5R4obo?2lc-1b zMLm2lDtx?U>{^SXGRm?#;75%t>mubrQNvVp;jP27P!2 zC*!QnmURa{haEAai)FRM9OHa!NIifI6}GAW-kcjHA6YBn+n1Gq6iH$;CKLZnS4yxZ0Y|QvpwF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onten" -#: analysis/templates/analysis/reports/includes/card_intervention.html:10 -#: intervention/tables.py:66 -msgid "Interventions" -msgstr "Eingriffe" +#: analysis/templates/analysis/reports/includes/card_old_interventions.html:11 +msgid "Old interventions" +msgstr "Altfälle" -#: analysis/templates/analysis/reports/includes/card_intervention.html:17 -msgid "Total interventions" +#: analysis/templates/analysis/reports/includes/card_old_interventions.html:13 +msgid "Before" +msgstr "Vor" + +#: analysis/templates/analysis/reports/includes/intervention/amount.html:3 +#: compensation/forms/modalForms.py:351 +#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:34 +#: intervention/templates/intervention/detail/includes/deductions.html:31 +msgid "Amount" +msgstr "Menge" + +#: analysis/templates/analysis/reports/includes/intervention/amount.html:5 +msgid "" +"\n" +" Checked = Has been checked by the registration office according to " +"LKompVzVo\n" +" " +msgstr "" +"\n" +" Geprüft = Wurde von der zuständigen Zulassungsbehörde überprüft\n" +" " + +#: analysis/templates/analysis/reports/includes/intervention/amount.html:9 +msgid "" +"\n" +" Recorded = Has been checked and published by the conservation office\n" +" " +msgstr "" +"\n" +" Verzeichnet = Wurde von der Eintragungsstelle überprüft und veröffentlicht\n" +" " + +#: analysis/templates/analysis/reports/includes/intervention/amount.html:17 +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:8 +#: analysis/templates/analysis/reports/includes/intervention/laws.html:23 +#: analysis/templates/analysis/reports/includes/intervention/laws.html:43 +#: konova/templates/konova/home.html:23 konova/templates/konova/home.html:61 +#: konova/templates/konova/home.html:100 +msgid "Total" msgstr "Insgesamt" -#: analysis/templates/analysis/reports/includes/card_intervention.html:22 -msgid "Amount total" -msgstr "Anzahl insgesamt" - -#: analysis/templates/analysis/reports/includes/card_intervention.html:26 -msgid "Amount checked" -msgstr "Anzahl geprüft" - -#: analysis/templates/analysis/reports/includes/card_intervention.html:30 -msgid "Amount recorded" -msgstr "Anzahl verzeichnet" - -#: analysis/templates/analysis/reports/includes/card_intervention.html:37 -msgid "Law usage" -msgstr "Gesetzesanwendungen" - -#: analysis/templates/analysis/reports/includes/card_intervention.html:43 -#: intervention/forms/forms.py:68 -#: intervention/templates/intervention/detail/view.html:39 -#: intervention/templates/intervention/report/report.html:20 -msgid "Law" -msgstr "Gesetz" - -#: analysis/templates/analysis/reports/includes/card_intervention.html:46 +#: analysis/templates/analysis/reports/includes/intervention/amount.html:18 +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:9 +#: analysis/templates/analysis/reports/includes/intervention/laws.html:17 #: compensation/tables.py:35 #: compensation/templates/compensation/detail/compensation/view.html:43 #: intervention/tables.py:33 @@ -88,7 +103,9 @@ msgstr "Gesetz" msgid "Checked" msgstr "Geprüft" -#: analysis/templates/analysis/reports/includes/card_intervention.html:49 +#: analysis/templates/analysis/reports/includes/intervention/amount.html:19 +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:10 +#: analysis/templates/analysis/reports/includes/intervention/laws.html:20 #: compensation/tables.py:41 compensation/tables.py:181 #: compensation/templates/compensation/detail/compensation/view.html:57 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31 @@ -99,29 +116,58 @@ msgstr "Geprüft" msgid "Recorded" msgstr "Verzeichnet" -#: analysis/templates/analysis/reports/includes/card_intervention.html:52 -#: analysis/templates/analysis/reports/includes/card_intervention.html:72 -#: konova/templates/konova/home.html:23 konova/templates/konova/home.html:61 -#: konova/templates/konova/home.html:100 -msgid "Total" -msgstr "Insgesamt" +#: analysis/templates/analysis/reports/includes/intervention/card_intervention.html:10 +#: intervention/tables.py:66 +msgid "Interventions" +msgstr "Eingriffe" -#: analysis/templates/analysis/reports/includes/card_intervention.html:81 +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:2 +msgid "Compensated by" +msgstr "Kompensiert durch" + +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:7 +msgid "Compensation type" +msgstr "Kompensationsart" + +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:15 +#: compensation/tables.py:84 +#: compensation/templates/compensation/detail/compensation/view.html:19 +#: konova/templates/konova/home.html:49 templates/navbars/navbar.html:28 +msgid "Compensation" +msgstr "Kompensation" + +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:21 +#: compensation/forms/modalForms.py:75 +msgid "Payment" +msgstr "Zahlung" + +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:27 +msgid "Deductions" +msgstr "Abbuchungen" + +#: analysis/templates/analysis/reports/includes/intervention/laws.html:2 +msgid "Law usage" +msgstr "Gesetzesanwendungen" + +#: analysis/templates/analysis/reports/includes/intervention/laws.html:4 msgid "" "\n" -" Please note: One intervention can be based on " -"multiple laws. This table therefore does not\n" -" count\n" -" " +" Please note: One intervention can be based on multiple laws. This table " +"therefore does not\n" +" count\n" +" " msgstr "" +"\n" +" Beachten Sie: Ein Eingriff kann mehreren Gesetzen zugeordnet worden sein. Diese Tabelle zählt daher nicht die Eingriffe selbst " +", sondern wie oft ein Gesetz Anwendung fand.\n" +" " -#: analysis/templates/analysis/reports/includes/card_old_interventions.html:11 -msgid "Old interventions" -msgstr "Altfälle" - -#: analysis/templates/analysis/reports/includes/card_old_interventions.html:13 -msgid "Before" -msgstr "Vor" +#: analysis/templates/analysis/reports/includes/intervention/laws.html:14 +#: intervention/forms/forms.py:68 +#: intervention/templates/intervention/detail/view.html:39 +#: intervention/templates/intervention/report/report.html:20 +msgid "Law" +msgstr "Gesetz" #: analysis/templates/analysis/reports/index.html:6 #: templates/navbars/navbar.html:46 @@ -306,10 +352,6 @@ msgstr "Zahlung wird an diesem Datum erwartet" msgid "Additional comment, maximum {} letters" msgstr "Zusätzlicher Kommentar, maximal {} Zeichen" -#: compensation/forms/modalForms.py:75 -msgid "Payment" -msgstr "Zahlung" - #: compensation/forms/modalForms.py:76 msgid "Add a payment for intervention '{}'" msgstr "Neue Ersatzzahlung zu Eingriff '{}' hinzufügen" @@ -435,12 +477,6 @@ msgstr "Einheit" msgid "Select the unit" msgstr "Einheit wählen" -#: compensation/forms/modalForms.py:351 -#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:34 -#: intervention/templates/intervention/detail/includes/deductions.html:31 -msgid "Amount" -msgstr "Menge" - #: compensation/forms/modalForms.py:354 msgid "Insert the amount" msgstr "Menge eingeben" @@ -511,12 +547,6 @@ msgstr "Zuletzt bearbeitet" msgid "Open {}" msgstr "Öffne {}" -#: compensation/tables.py:84 -#: compensation/templates/compensation/detail/compensation/view.html:19 -#: konova/templates/konova/home.html:49 templates/navbars/navbar.html:28 -msgid "Compensation" -msgstr "Kompensation" - #: compensation/tables.py:105 intervention/tables.py:107 msgid "Not checked yet" msgstr "Noch nicht geprüft" @@ -781,7 +811,7 @@ msgstr "Gefördert mit" #: intervention/templates/intervention/report/report.html:57 #: intervention/templates/intervention/report/report.html:78 msgid "None" -msgstr "" +msgstr "-" #: compensation/templates/compensation/detail/compensation/view.html:84 #: compensation/templates/compensation/detail/eco_account/view.html:83 @@ -834,8 +864,6 @@ msgid "Created" msgstr "Erstellt" #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:54 -#, fuzzy -#| msgid "Recorded on " msgid "Recorded on" msgstr "Verzeichnet am" @@ -3001,6 +3029,18 @@ msgstr "" msgid "A fontawesome icon field" msgstr "" +#~ msgid "Total interventions" +#~ msgstr "Insgesamt" + +#~ msgid "Amount total" +#~ msgstr "Anzahl insgesamt" + +#~ msgid "Amount checked" +#~ msgstr "Anzahl geprüft" + +#~ msgid "Amount recorded" +#~ msgstr "Anzahl verzeichnet" + #~ msgid "Funding by..." #~ msgstr "Gefördert mit..." -- 2.45.2 From 88c7f649010367ad65feb33540fe0f0ae2904908 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Tue, 19 Oct 2021 13:34:33 +0200 Subject: [PATCH 03/14] #26 Annual conservation report * finishes compensation analysis report --- .../templates/analysis/reports/detail.html | 2 +- .../reports/includes/compensation/amount.html | 55 +++++++ .../{ => compensation}/card_compensation.html | 2 +- .../reports/includes/intervention/amount.html | 20 +-- .../includes/intervention/compensated_by.html | 10 +- .../reports/includes/intervention/laws.html | 4 +- analysis/utils/report.py | 140 ++++++++++++++++++ locale/de/LC_MESSAGES/django.mo | Bin 25882 -> 26230 bytes locale/de/LC_MESSAGES/django.po | 76 +++++++--- 9 files changed, 266 insertions(+), 43 deletions(-) create mode 100644 analysis/templates/analysis/reports/includes/compensation/amount.html rename analysis/templates/analysis/reports/includes/{ => compensation}/card_compensation.html (90%) diff --git a/analysis/templates/analysis/reports/detail.html b/analysis/templates/analysis/reports/detail.html index 219ad46d..f90acdaf 100644 --- a/analysis/templates/analysis/reports/detail.html +++ b/analysis/templates/analysis/reports/detail.html @@ -10,7 +10,7 @@
{% include 'analysis/reports/includes/intervention/card_intervention.html' %} - {% include 'analysis/reports/includes/card_compensation.html' %} + {% include 'analysis/reports/includes/compensation/card_compensation.html' %} {% include 'analysis/reports/includes/card_eco_account.html' %} {% include 'analysis/reports/includes/card_old_interventions.html' %}
diff --git a/analysis/templates/analysis/reports/includes/compensation/amount.html b/analysis/templates/analysis/reports/includes/compensation/amount.html new file mode 100644 index 00000000..27b79f65 --- /dev/null +++ b/analysis/templates/analysis/reports/includes/compensation/amount.html @@ -0,0 +1,55 @@ +{% load i18n fontawesome_5 ksp_filters %} + +

{% trans 'Amount' %}

+ + {% blocktrans %} + Checked = Has been checked by the registration office according to LKompVzVo + {% endblocktrans %} +
+ {% blocktrans %} + Recorded = Has been checked and published by the conservation office + {% endblocktrans %} +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans 'Area of responsibility' %}{% fa5_icon 'star' %} {% trans 'Checked' %}{% fa5_icon 'bookmark' %} {% trans 'Recorded' %}{% trans 'Number single areas' %}{% trans 'Total' %}
{% trans 'Conservation office by law' %}{{report.compensation_report.queryset_registration_office_unb_checked.count|default_if_zero:"-"}}{{report.compensation_report.queryset_registration_office_unb_recorded.count|default_if_zero:"-"}}{{report.compensation_report.num_single_surfaces_total_unb|default_if_zero:"-"}}{{report.compensation_report.queryset_registration_office_unb.count|default_if_zero:"-"}}
{% trans 'Land-use planning' %}{{report.compensation_report.queryset_registration_office_tbp_checked.count|default_if_zero:"-"}}{{report.compensation_report.queryset_registration_office_tbp_recorded.count|default_if_zero:"-"}}{{report.compensation_report.num_single_surfaces_total_tbp|default_if_zero:"-"}}{{report.compensation_report.queryset_registration_office_tbp.count|default_if_zero:"-"}}
{% trans 'Other registration office' %}{{report.compensation_report.queryset_registration_office_other_checked.count|default_if_zero:"-"}}{{report.compensation_report.queryset_registration_office_other_recorded.count|default_if_zero:"-"}}{{report.compensation_report.num_single_surfaces_total_other|default_if_zero:"-"}}{{report.compensation_report.queryset_registration_office_other.count|default_if_zero:"-"}}
{% trans 'Total' %}{{report.compensation_report.queryset_checked.count|default_if_zero:"-"}}{{report.compensation_report.queryset_recorded.count|default_if_zero:"-"}}{{report.compensation_report.num_single_surfaces_total|default_if_zero:"-"}}{{report.compensation_report.queryset.count|default_if_zero:"-"}}
+
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/card_compensation.html b/analysis/templates/analysis/reports/includes/compensation/card_compensation.html similarity index 90% rename from analysis/templates/analysis/reports/includes/card_compensation.html rename to analysis/templates/analysis/reports/includes/compensation/card_compensation.html index 24d0eabf..8fe2eec4 100644 --- a/analysis/templates/analysis/reports/includes/card_compensation.html +++ b/analysis/templates/analysis/reports/includes/compensation/card_compensation.html @@ -15,7 +15,7 @@
- {% include 'form/table/generic_table_form_body.html' %} + {% include 'analysis/reports/includes/compensation/amount.html' %}
diff --git a/analysis/templates/analysis/reports/includes/intervention/amount.html b/analysis/templates/analysis/reports/includes/intervention/amount.html index 8ecbe018..e2b94a31 100644 --- a/analysis/templates/analysis/reports/includes/intervention/amount.html +++ b/analysis/templates/analysis/reports/includes/intervention/amount.html @@ -13,18 +13,18 @@
- - - - - + + + + + - - - - - + + + + +
{% trans 'Total' %}{% fa5_icon 'star' %} {% trans 'Checked' %}{% fa5_icon 'bookmark' %} {% trans 'Recorded' %}
{% fa5_icon 'star' %} {% trans 'Checked' %}{% fa5_icon 'bookmark' %} {% trans 'Recorded' %}{% trans 'Total' %}
{{report.intervention_report.queryset.count|default_if_zero:"-"}}{{report.intervention_report.queryset_checked.count|default_if_zero:"-"}}{{report.intervention_report.queryset_recorded.count|default_if_zero:"-"}}
{{report.intervention_report.queryset_checked.count|default_if_zero:"-"}}{{report.intervention_report.queryset_recorded.count|default_if_zero:"-"}}{{report.intervention_report.queryset.count|default_if_zero:"-"}}
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/intervention/compensated_by.html b/analysis/templates/analysis/reports/includes/intervention/compensated_by.html index 8608f113..c6be40cc 100644 --- a/analysis/templates/analysis/reports/includes/intervention/compensated_by.html +++ b/analysis/templates/analysis/reports/includes/intervention/compensated_by.html @@ -5,29 +5,29 @@ {% trans 'Compensation type' %} + {% fa5_icon 'star' %} {% trans 'Checked' %} + {% fa5_icon 'bookmark' %} {% trans 'Recorded' %} {% trans 'Total' %} - {% trans 'Checked' %} - {% trans 'Recorded' %} {% trans 'Compensation' %} - {{report.intervention_report.compensation_sum|default_if_zero:"-"}} {{report.intervention_report.compensation_sum_checked|default_if_zero:"-"}} {{report.intervention_report.compensation_sum_recorded|default_if_zero:"-"}} + {{report.intervention_report.compensation_sum|default_if_zero:"-"}} {% trans 'Payment' %} - {{report.intervention_report.payment_sum|default_if_zero:"-"}} {{report.intervention_report.payment_sum_checked|default_if_zero:"-"}} {{report.intervention_report.payment_sum_recorded|default_if_zero:"-"}} + {{report.intervention_report.payment_sum|default_if_zero:"-"}} {% trans 'Deductions' %} - {{report.intervention_report.deduction_sum|default_if_zero:"-"}} {{report.intervention_report.deduction_sum_checked|default_if_zero:"-"}} {{report.intervention_report.deduction_sum_recorded|default_if_zero:"-"}} + {{report.intervention_report.deduction_sum|default_if_zero:"-"}} diff --git a/analysis/templates/analysis/reports/includes/intervention/laws.html b/analysis/templates/analysis/reports/includes/intervention/laws.html index 8e04341c..e310197f 100644 --- a/analysis/templates/analysis/reports/includes/intervention/laws.html +++ b/analysis/templates/analysis/reports/includes/intervention/laws.html @@ -14,10 +14,10 @@ {% trans 'Law' %} - {% trans 'Checked' %} + {% fa5_icon 'star' %} {% trans 'Checked' %} - {% trans 'Recorded' %} + {% fa5_icon 'bookmark' %} {% trans 'Recorded' %} {% trans 'Total' %} diff --git a/analysis/utils/report.py b/analysis/utils/report.py index fbc88520..ce5d895a 100644 --- a/analysis/utils/report.py +++ b/analysis/utils/report.py @@ -5,12 +5,14 @@ Contact: michel.peltriaux@sgdnord.rlp.de Created on: 18.10.21 """ +from django.contrib.gis.db.models.functions import NumGeometries from django.db.models import Count, Sum, Q from codelist.models import KonovaCode from codelist.settings import CODELIST_LAW_ID from compensation.models import Compensation, Payment, EcoAccountDeduction from intervention.models import Intervention +from konova.models import Geometry class TimespanReport: @@ -122,6 +124,144 @@ class TimespanReport: self.deduction_sum_checked = deductions.filter(intervention__checked__isnull=False).count() self.deduction_sum_recorded = deductions.filter(intervention__recorded__isnull=False).count() + class CompensationReport: + queryset = Compensation.objects.none() + queryset_checked = Compensation.objects.none() + queryset_recorded = Compensation.objects.none() + + queryset_registration_office_unb = Compensation.objects.none() + queryset_registration_office_unb_checked = Compensation.objects.none() + queryset_registration_office_unb_recorded = Compensation.objects.none() + num_single_surfaces_total_unb = -1 + + queryset_registration_office_tbp = Compensation.objects.none() + queryset_registration_office_tbp_checked = Compensation.objects.none() + queryset_registration_office_tbp_recorded = Compensation.objects.none() + num_single_surfaces_total_tbp = -1 + + queryset_registration_office_other = Compensation.objects.none() + queryset_registration_office_other_checked = Compensation.objects.none() + queryset_registration_office_other_recorded = Compensation.objects.none() + num_single_surfaces_total_other = -1 + + num_single_surfaces_total = -1 + num_single_surfaces_recorded = -1 + + # Code list id for 'Träger der Bauleitplanung' parent + id_tbp = 1943695 + # Code list id for 'untere Naturschutzbehörde' + id_unb = 1943087 + # Code list id for 'obere Naturschutzbehörde' + id_onb = 1943084 + + def __init__(self, id: str): + self.queryset = Compensation.objects.filter( + intervention__responsible__conservation_office__id=id, + deleted=None, + ) + self.queryset_checked = self.queryset.filter( + intervention__checked__isnull=False + ) + self.queryset_recorded = self.queryset.filter( + intervention__recorded__isnull=False + ) + self._create_report() + + def _create_report(self): + """ Creates all report information + + Returns: + + """ + self._evaluate_compensation_responsibility() + self._evaluate_surfaces() + + def _evaluate_surfaces(self): + """ Evaluates the surfaces of compensation Multipolygon fields + + Returns: + + """ + # Evaluate all surfaces + ids = self.queryset.values_list("geometry_id") + self.num_single_surfaces_total = self._count_geometry_surfaces(ids) + + # Evaluate surfaces where the conservation office is the registration office as well + ids = self.queryset_registration_office_unb.values_list("geometry_id") + self.num_single_surfaces_total_unb = self._count_geometry_surfaces(ids) + + # Evaluates surfaces where the registration office is a Träger Bauleitplanung + ids = self.queryset_registration_office_tbp.values_list("geometry_id") + self.num_single_surfaces_total_tbp = self._count_geometry_surfaces(ids) + + # Evaluates surfaces where any other registration office is responsible + ids = self.queryset_registration_office_other.values_list("geometry_id") + self.num_single_surfaces_total_other = self._count_geometry_surfaces(ids) + + def _count_geometry_surfaces(self, ids: list): + """ Wraps counting of geometry surfaces from a given list of ids + + Args: + ids (list): List of geometry ids + + Returns: + + """ + # Now select all geometries matching the ids + # Then perform a ST_NumGeometries variant over all geometries + # Then sum up all of the calculated surface numbers + return Geometry.objects.filter( + id__in=ids + ).annotate( + num=NumGeometries("geom") + ).aggregate( + num_geoms=Sum("num") + )["num_geoms"] or 0 + + def _evaluate_compensation_responsibility(self): + """ Evaluates compensations based on different responsibility areas + + unb -> Untere Naturschutzbehörde + Holds entries where conservation_office and registration_office basically are the same + tbp -> Träger Bauleitplanung + Holds entries where registration_office is a Träger der Bauleitplanung + other -> Other registration offices + Holds all other entries + + Returns: + + """ + self.queryset_registration_office_unb = self.queryset.filter( + intervention__responsible__registration_office__parent__id=self.id_unb + ) + self.queryset_registration_office_unb_recorded = self.queryset_registration_office_unb.filter( + intervention__recorded__isnull=False, + ) + self.queryset_registration_office_unb_checked = self.queryset_registration_office_unb.filter( + intervention__checked__isnull=False, + ) + + self.queryset_registration_office_tbp = self.queryset.filter( + intervention__responsible__registration_office__parent__id=self.id_tbp + ) + self.queryset_registration_office_tbp_recorded = self.queryset_registration_office_tbp.filter( + intervention__recorded__isnull=False, + ) + self.queryset_registration_office_tbp_checked = self.queryset_registration_office_tbp.filter( + intervention__checked__isnull=False, + ) + + self.queryset_registration_office_other = self.queryset.exclude( + Q(id__in=self.queryset_registration_office_tbp) | Q(id__in=self.queryset_registration_office_unb) + ) + self.queryset_registration_office_other_recorded = self.queryset_registration_office_other.filter( + intervention__recorded__isnull=False, + ) + self.queryset_registration_office_other_checked = self.queryset_registration_office_other.filter( + intervention__checked__isnull=False, + ) + def __init__(self, office_id: str): self.office_id = office_id self.intervention_report = self.InterventionReport(self.office_id) + self.compensation_report = self.CompensationReport(self.office_id) diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 9b21d9f7b429469e5694404e04790d94dbaa2e39..1523b7ae2d3e587da16b406cbee6b727124a13cb 100644 GIT binary patch delta 8499 zcmZwMd016-9>?(m2#A=7AmWl-Hx?CH%y3s+5Ht~k+&7lXqI6X*Bx-t0Q`CG-XG47C;yo9JYQeG?flkr4)>|2YJ4v5^|4Ph zsrQ7%b+3ThQ6kbOUX1BGhOx%U{ zV`w|ex)oPr6Wngxg8}4^B175MNfHeyIE#(&sxhd2Z38P3DYDw5>eDeCM`L3w#Za7Q z@{eK&`HdKcub|q0fV%$(YP{36dE2rsnTmQHEbA63!jPF+ZBR3h$7t-2eprNB!8FtW zWvC99pzdFV5x5D1@J-YNccJb(gbnZ*Her10Clc!5iZOuE)G!R=u?4cLRyt~B(=ZU{ zVhk?A=C~C#@effGJ7_$GYJUZ_ARlhhPK2Yaf!mSL7A2x?9E>`ig6jAr>S)fR`tylp5!e)YjI2bY%F2r6{54P|1%bF4>*EHK-;C>c2s4<&Rho&!JX$5jC;EIA=mlQ4?y9I+AW!AN$3z|LQQ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Xm=-N)Y zG38mduG5=DM_b`VYnnB}D#lZ9JibW`CUo_r>=Je@&bdE!LMG*}VgT_LF@wA=Ukt{s zIGlJx`~M*YrO5n8H6FUAke)!)Bf@NX2K99HaWS2&4X_sXE?`BX9Wk6ZO6(`1h^j<3 zbr#@A{2Xs+{~MBdh0GA5+UY)p uTkB\n" "Language-Team: LANGUAGE \n" @@ -37,13 +37,6 @@ msgstr "" msgid "Report" msgstr "Bericht" -#: analysis/templates/analysis/reports/includes/card_compensation.html:11 -#: compensation/tables.py:62 -#: intervention/templates/intervention/detail/includes/compensations.html:8 -#: intervention/templates/intervention/report/report.html:49 -msgid "Compensations" -msgstr "Kompensationen" - #: analysis/templates/analysis/reports/includes/card_eco_account.html:11 msgid "Eco-Accounts" msgstr "Ökokonten" @@ -56,6 +49,7 @@ msgstr "Altfälle" msgid "Before" msgstr "Vor" +#: analysis/templates/analysis/reports/includes/compensation/amount.html:3 #: analysis/templates/analysis/reports/includes/intervention/amount.html:3 #: compensation/forms/modalForms.py:351 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:34 @@ -63,6 +57,7 @@ msgstr "Vor" msgid "Amount" msgstr "Menge" +#: analysis/templates/analysis/reports/includes/compensation/amount.html:5 #: analysis/templates/analysis/reports/includes/intervention/amount.html:5 msgid "" "\n" @@ -74,6 +69,7 @@ msgstr "" " Geprüft = Wurde von der zuständigen Zulassungsbehörde überprüft\n" " " +#: analysis/templates/analysis/reports/includes/compensation/amount.html:9 #: analysis/templates/analysis/reports/includes/intervention/amount.html:9 msgid "" "\n" @@ -81,9 +77,53 @@ msgid "" " " msgstr "" "\n" -" Verzeichnet = Wurde von der Eintragungsstelle überprüft und veröffentlicht\n" +" Verzeichnet = Wurde von der Eintragungsstelle überprüft und " +"veröffentlicht\n" " " +#: analysis/templates/analysis/reports/includes/compensation/amount.html:17 +msgid "Area of responsibility" +msgstr "Zuständigkeitsbereich" + +#: analysis/templates/analysis/reports/includes/compensation/amount.html:18 +#: analysis/templates/analysis/reports/includes/compensation/card_compensation.html:11 +#: compensation/tables.py:62 +#: intervention/templates/intervention/detail/includes/compensations.html:8 +#: intervention/templates/intervention/report/report.html:49 +msgid "Compensations" +msgstr "Kompensationen" + +#: analysis/templates/analysis/reports/includes/compensation/amount.html:19 +#: analysis/templates/analysis/reports/includes/intervention/amount.html:19 +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:10 +#: analysis/templates/analysis/reports/includes/intervention/laws.html:20 +#: compensation/tables.py:41 compensation/tables.py:181 +#: compensation/templates/compensation/detail/compensation/view.html:57 +#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31 +#: compensation/templates/compensation/detail/eco_account/view.html:44 +#: ema/tables.py:38 ema/templates/ema/detail/view.html:28 +#: intervention/tables.py:39 +#: intervention/templates/intervention/detail/view.html:82 user/models.py:49 +msgid "Recorded" +msgstr "Verzeichnet" + +#: analysis/templates/analysis/reports/includes/compensation/amount.html:20 +msgid "Number single areas" +msgstr "Einzelflächen" + +#: analysis/templates/analysis/reports/includes/compensation/amount.html:25 +msgid "Conservation office by law" +msgstr "Naturschutzbehörde (§17 Abs.3 BNatSchG)" + +#: analysis/templates/analysis/reports/includes/compensation/amount.html:31 +msgid "Other registration office" +msgstr "Andere Zulassungsbehörden" + +#: analysis/templates/analysis/reports/includes/compensation/amount.html:37 +msgid "Land-use planning" +msgstr "Träger Bauleitplanung" + +#: analysis/templates/analysis/reports/includes/compensation/amount.html:43 #: analysis/templates/analysis/reports/includes/intervention/amount.html:17 #: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:8 #: analysis/templates/analysis/reports/includes/intervention/laws.html:23 @@ -103,19 +143,6 @@ msgstr "Insgesamt" msgid "Checked" msgstr "Geprüft" -#: analysis/templates/analysis/reports/includes/intervention/amount.html:19 -#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:10 -#: analysis/templates/analysis/reports/includes/intervention/laws.html:20 -#: compensation/tables.py:41 compensation/tables.py:181 -#: compensation/templates/compensation/detail/compensation/view.html:57 -#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31 -#: compensation/templates/compensation/detail/eco_account/view.html:44 -#: ema/tables.py:38 ema/templates/ema/detail/view.html:28 -#: intervention/tables.py:39 -#: intervention/templates/intervention/detail/view.html:82 user/models.py:49 -msgid "Recorded" -msgstr "Verzeichnet" - #: analysis/templates/analysis/reports/includes/intervention/card_intervention.html:10 #: intervention/tables.py:66 msgid "Interventions" @@ -158,8 +185,9 @@ msgid "" " " msgstr "" "\n" -" Beachten Sie: Ein Eingriff kann mehreren Gesetzen zugeordnet worden sein. Diese Tabelle zählt daher nicht die Eingriffe selbst " -", sondern wie oft ein Gesetz Anwendung fand.\n" +" Beachten Sie: Ein Eingriff kann mehreren Gesetzen zugeordnet worden " +"sein. Diese Tabelle zählt daher nicht die Eingriffe selbst , sondern wie oft " +"ein Gesetz Anwendung fand.\n" " " #: analysis/templates/analysis/reports/includes/intervention/laws.html:14 -- 2.45.2 From 0e9a169d381875d9279564ade8f4eb7515266b2a Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Tue, 19 Oct 2021 14:22:41 +0200 Subject: [PATCH 04/14] #26 Annual conservation report * finishes intervention analysis report for cases before 16.06.2018 (LKompVzVo) --- analysis/settings.py | 12 ++++++++ .../templates/analysis/reports/detail.html | 2 +- .../includes/old_intervention/amount.html | 30 +++++++++++++++++++ .../card_old_interventions.html | 2 +- analysis/utils/report.py | 23 ++++++++++++++ analysis/views.py | 22 ++++++-------- 6 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 analysis/settings.py create mode 100644 analysis/templates/analysis/reports/includes/old_intervention/amount.html rename analysis/templates/analysis/reports/includes/{ => old_intervention}/card_old_interventions.html (91%) diff --git a/analysis/settings.py b/analysis/settings.py new file mode 100644 index 00000000..5ea5fadf --- /dev/null +++ b/analysis/settings.py @@ -0,0 +1,12 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: michel.peltriaux@sgdnord.rlp.de +Created on: 19.10.21 + +""" + +import datetime + +# Defines the date of the legal publishing of the LKompVzVo +LKOMPVZVO_PUBLISH_DATE = datetime.date.fromisoformat("2018-06-16") diff --git a/analysis/templates/analysis/reports/detail.html b/analysis/templates/analysis/reports/detail.html index f90acdaf..42322418 100644 --- a/analysis/templates/analysis/reports/detail.html +++ b/analysis/templates/analysis/reports/detail.html @@ -12,6 +12,6 @@ {% include 'analysis/reports/includes/intervention/card_intervention.html' %} {% include 'analysis/reports/includes/compensation/card_compensation.html' %} {% include 'analysis/reports/includes/card_eco_account.html' %} - {% include 'analysis/reports/includes/card_old_interventions.html' %} + {% include 'analysis/reports/includes/old_intervention/card_old_interventions.html' %} {% endblock %} \ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/old_intervention/amount.html b/analysis/templates/analysis/reports/includes/old_intervention/amount.html new file mode 100644 index 00000000..5ab45a93 --- /dev/null +++ b/analysis/templates/analysis/reports/includes/old_intervention/amount.html @@ -0,0 +1,30 @@ +{% load i18n fontawesome_5 ksp_filters %} + +

{% trans 'Amount' %}

+ + {% blocktrans %} + Checked = Has been checked by the registration office according to LKompVzVo + {% endblocktrans %} +
+ {% blocktrans %} + Recorded = Has been checked and published by the conservation office + {% endblocktrans %} +
+
+ + + + + + + + + + + + + + + +
{% fa5_icon 'star' %} {% trans 'Checked' %}{% fa5_icon 'bookmark' %} {% trans 'Recorded' %}{% trans 'Total' %}
{{report.old_intervention_report.queryset_checked.count|default_if_zero:"-"}}{{report.old_intervention_report.queryset_recorded.count|default_if_zero:"-"}}{{report.old_intervention_report.queryset.count|default_if_zero:"-"}}
+
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/card_old_interventions.html b/analysis/templates/analysis/reports/includes/old_intervention/card_old_interventions.html similarity index 91% rename from analysis/templates/analysis/reports/includes/card_old_interventions.html rename to analysis/templates/analysis/reports/includes/old_intervention/card_old_interventions.html index 400d0085..3a272874 100644 --- a/analysis/templates/analysis/reports/includes/card_old_interventions.html +++ b/analysis/templates/analysis/reports/includes/old_intervention/card_old_interventions.html @@ -16,7 +16,7 @@
- {% include 'form/table/generic_table_form_body.html' %} + {% include 'analysis/reports/includes/old_intervention/amount.html' %}
diff --git a/analysis/utils/report.py b/analysis/utils/report.py index ce5d895a..12d0a46c 100644 --- a/analysis/utils/report.py +++ b/analysis/utils/report.py @@ -8,6 +8,7 @@ Created on: 18.10.21 from django.contrib.gis.db.models.functions import NumGeometries from django.db.models import Count, Sum, Q +from analysis.settings import LKOMPVZVO_PUBLISH_DATE from codelist.models import KonovaCode from codelist.settings import CODELIST_LAW_ID from compensation.models import Compensation, Payment, EcoAccountDeduction @@ -23,6 +24,7 @@ class TimespanReport: queryset_checked = Intervention.objects.none() queryset_recorded = Intervention.objects.none() + # Law related law_sum = -1 law_sum_checked = -1 @@ -43,6 +45,7 @@ class TimespanReport: def __init__(self, id: str): self.queryset = Intervention.objects.filter( responsible__conservation_office__id=id, + legal__registration_date__gt=LKOMPVZVO_PUBLISH_DATE, deleted=None, ) self.queryset_checked = self.queryset.filter( @@ -157,6 +160,7 @@ class TimespanReport: def __init__(self, id: str): self.queryset = Compensation.objects.filter( intervention__responsible__conservation_office__id=id, + intervention__legal__registration_date__gt=LKOMPVZVO_PUBLISH_DATE, deleted=None, ) self.queryset_checked = self.queryset.filter( @@ -261,7 +265,26 @@ class TimespanReport: intervention__checked__isnull=False, ) + class OldInterventionReport: + queryset = Compensation.objects.none() + queryset_checked = Compensation.objects.none() + queryset_recorded = Compensation.objects.none() + + def __init__(self, id: str): + self.queryset = Intervention.objects.filter( + legal__registration_date__lte=LKOMPVZVO_PUBLISH_DATE, + responsible__conservation_office__id=id, + deleted=None, + ) + self.queryset_checked = self.queryset.filter( + checked__isnull=False + ) + self.queryset_recorded = self.queryset.filter( + recorded__isnull=False + ) + def __init__(self, office_id: str): self.office_id = office_id self.intervention_report = self.InterventionReport(self.office_id) self.compensation_report = self.CompensationReport(self.office_id) + self.old_intervention_report = self.OldInterventionReport(self.office_id) diff --git a/analysis/views.py b/analysis/views.py index 43dd061b..b7699719 100644 --- a/analysis/views.py +++ b/analysis/views.py @@ -31,23 +31,19 @@ def index_reports_view(request: HttpRequest): def detail_report_view(request: HttpRequest, id: str): + """ Renders the detailed report for a conservation office + + Args: + request (HttpRequest): The incoming request + id (str): The conservation_office KonovaCode id + + Returns: + + """ cons_office = get_object_or_404( KonovaCode, id=id, ) - cons_interventions = Intervention.objects.filter( - responsible__conservation_office__id=id, - deleted=None, - ) - cons_comps = Compensation.objects.filter( - intervention__in=cons_interventions, - deleted=None, - ) - cons_eco_account = EcoAccount.objects.filter( - responsible__conservation_office__id=id, - deleted=None, - ) - report = TimespanReport(id) template = "analysis/reports/detail.html" -- 2.45.2 From b90a07ca2a8275fc7553a4651f0a28a5e86040ab Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Tue, 19 Oct 2021 16:06:19 +0200 Subject: [PATCH 05/14] #26 Annual conservation report * WIP: EcoAccountReport --- .../templates/analysis/reports/detail.html | 2 +- .../reports/includes/eco_account/amount.html | 32 ++++ .../{ => eco_account}/card_eco_account.html | 4 +- .../includes/eco_account/deductions.html | 23 +++ analysis/utils/report.py | 65 +++++++- analysis/views.py | 5 - konova/models.py | 3 +- locale/de/LC_MESSAGES/django.mo | Bin 26230 -> 26257 bytes locale/de/LC_MESSAGES/django.po | 144 ++++++++++-------- 9 files changed, 208 insertions(+), 70 deletions(-) create mode 100644 analysis/templates/analysis/reports/includes/eco_account/amount.html rename analysis/templates/analysis/reports/includes/{ => eco_account}/card_eco_account.html (80%) create mode 100644 analysis/templates/analysis/reports/includes/eco_account/deductions.html diff --git a/analysis/templates/analysis/reports/detail.html b/analysis/templates/analysis/reports/detail.html index 42322418..4497adf3 100644 --- a/analysis/templates/analysis/reports/detail.html +++ b/analysis/templates/analysis/reports/detail.html @@ -11,7 +11,7 @@
{% include 'analysis/reports/includes/intervention/card_intervention.html' %} {% include 'analysis/reports/includes/compensation/card_compensation.html' %} - {% include 'analysis/reports/includes/card_eco_account.html' %} + {% include 'analysis/reports/includes/eco_account/card_eco_account.html' %} {% include 'analysis/reports/includes/old_intervention/card_old_interventions.html' %}
{% endblock %} \ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/eco_account/amount.html b/analysis/templates/analysis/reports/includes/eco_account/amount.html new file mode 100644 index 00000000..092ee9a8 --- /dev/null +++ b/analysis/templates/analysis/reports/includes/eco_account/amount.html @@ -0,0 +1,32 @@ +{% load i18n fontawesome_5 ksp_filters %} + +

{% trans 'Amount' %}

+ + {% blocktrans %} + Checked = Has been checked by the registration office according to LKompVzVo + {% endblocktrans %} +
+ {% blocktrans %} + Recorded = Has been checked and published by the conservation office + {% endblocktrans %} +
+
+ + + + + + + + + + + + + + + + + +
{% trans 'Before' %} LKompVzVo{% trans 'After' %} LKompVzVo{% fa5_icon 'bookmark' %} {% trans 'Recorded' %}{% trans 'Total' %}
{{report.eco_account_report.queryset_old.count|default_if_zero:"-"}}{{report.eco_account_report.queryset.count|default_if_zero:"-"}}{{report.eco_account_report.queryset_recorded.count|default_if_zero:"-"}}{{report.eco_account_report.queryset_total.count|default_if_zero:"-"}}
+
\ No newline at end of file diff --git a/analysis/templates/analysis/reports/includes/card_eco_account.html b/analysis/templates/analysis/reports/includes/eco_account/card_eco_account.html similarity index 80% rename from analysis/templates/analysis/reports/includes/card_eco_account.html rename to analysis/templates/analysis/reports/includes/eco_account/card_eco_account.html index 744ce07f..850ac60a 100644 --- a/analysis/templates/analysis/reports/includes/card_eco_account.html +++ b/analysis/templates/analysis/reports/includes/eco_account/card_eco_account.html @@ -15,7 +15,9 @@
- {% include 'form/table/generic_table_form_body.html' %} + {% include 'analysis/reports/includes/eco_account/amount.html' %} +
+ {% include 'analysis/reports/includes/eco_account/deductions.html' %}
diff --git a/analysis/templates/analysis/reports/includes/eco_account/deductions.html b/analysis/templates/analysis/reports/includes/eco_account/deductions.html new file mode 100644 index 00000000..1520e080 --- /dev/null +++ b/analysis/templates/analysis/reports/includes/eco_account/deductions.html @@ -0,0 +1,23 @@ +{% load i18n fontawesome_5 ksp_filters %} + +

{% trans 'Deductions' %}

+
+ + + + + + + + + + + + + + + + + +
{% fa5_icon 'bookmark' %} {% trans 'Recorded' %}{% fa5_icon 'bookmark' %} {% trans 'Recorded' %} {% trans 'Surface' %}{% trans 'Total' %}{% trans 'Total' %} {% trans 'Surface' %}
{{report.eco_account_report.queryset_deductions_recorded.count|default_if_zero:"-"}}{{report.eco_account_report.recorded_deductions_sq_m|default_if_zero:"-"}}m²{{report.eco_account_report.queryset_deductions_recorded.count|default_if_zero:"-"}}{{report.eco_account_report.deductions_sq_m|default_if_zero:"-"}}m²
+
\ No newline at end of file diff --git a/analysis/utils/report.py b/analysis/utils/report.py index 12d0a46c..4792a166 100644 --- a/analysis/utils/report.py +++ b/analysis/utils/report.py @@ -5,13 +5,16 @@ Contact: michel.peltriaux@sgdnord.rlp.de Created on: 18.10.21 """ +from django.contrib.gis.db.models import MultiPolygonField from django.contrib.gis.db.models.functions import NumGeometries +from django.contrib.gis.measure import Area from django.db.models import Count, Sum, Q +from django.db.models.functions import Cast from analysis.settings import LKOMPVZVO_PUBLISH_DATE from codelist.models import KonovaCode from codelist.settings import CODELIST_LAW_ID -from compensation.models import Compensation, Payment, EcoAccountDeduction +from compensation.models import Compensation, Payment, EcoAccountDeduction, EcoAccount from intervention.models import Intervention from konova.models import Geometry @@ -217,7 +220,9 @@ class TimespanReport: return Geometry.objects.filter( id__in=ids ).annotate( - num=NumGeometries("geom") + geom_cast=Cast("geom", MultiPolygonField()) + ).annotate( + num=NumGeometries("geom_cast") ).aggregate( num_geoms=Sum("num") )["num_geoms"] or 0 @@ -265,6 +270,61 @@ class TimespanReport: intervention__checked__isnull=False, ) + class EcoAccountReport: + queryset = EcoAccount.objects.none() + queryset_recorded = EcoAccount.objects.none() + queryset_old = EcoAccount.objects.none() + queryset_deductions = EcoAccountDeduction.objects.none() + queryset_deductions_recorded = EcoAccountDeduction.objects.none() + queryset_has_deductions = EcoAccountDeduction.objects.none() + + # Total size of deductions + deductions_sq_m = -1 + recorded_deductions_sq_m = -1 + + def __init__(self, id: str): + # First fetch all eco account for this office + self.queryset_total = EcoAccount.objects.filter( + responsible__conservation_office__id=id, + deleted=None, + ) + self.queryset_recorded = self.queryset_total.filter( + recorded__isnull=False + ) + # Then fetch the old ones (pre-LKompVzVo) + self.queryset_old = self.queryset_total.filter( + recorded__timestamp__lte=LKOMPVZVO_PUBLISH_DATE, + ) + # Then fetch the default queryset with the new ones (post-LKompVzVo) + self.queryset = self.queryset_total.filter( + recorded__timestamp__gte=LKOMPVZVO_PUBLISH_DATE, + ) + # Fetch all related deductions + self.queryset_deductions = EcoAccountDeduction.objects.filter( + account__id__in=self.queryset.values_list("id") + ) + # Fetch deductions for interventions which are already recorded + self.queryset_deductions_recorded = self.queryset_deductions.filter( + intervention__recorded__isnull=False + ) + self._create_report() + + def _create_report(self): + """ Creates all report information + + Returns: + + """ + self._evaluate_deductions() + + def _evaluate_deductions(self): + self.deductions_sq_m = self.queryset_deductions.aggregate( + sum=Sum("surface") + )["sum"] + self.recorded_deductions_sq_m = self.queryset_deductions_recorded.aggregate( + sum=Sum("surface") + )["sum"] + class OldInterventionReport: queryset = Compensation.objects.none() queryset_checked = Compensation.objects.none() @@ -287,4 +347,5 @@ class TimespanReport: self.office_id = office_id self.intervention_report = self.InterventionReport(self.office_id) self.compensation_report = self.CompensationReport(self.office_id) + self.eco_account_report = self.EcoAccountReport(self.office_id) self.old_intervention_report = self.OldInterventionReport(self.office_id) diff --git a/analysis/views.py b/analysis/views.py index b7699719..7e297e6a 100644 --- a/analysis/views.py +++ b/analysis/views.py @@ -1,14 +1,9 @@ from django.contrib.auth.decorators import login_required -from django.db.models import Count, Q, Sum from django.http import HttpRequest from django.shortcuts import render, get_object_or_404 from analysis.utils.report import TimespanReport from codelist.models import KonovaCode -from codelist.settings import CODELIST_LAW_ID -from compensation.models import EcoAccount, Compensation -from ema.models import Ema -from intervention.models import Intervention from konova.contexts import BaseContext from konova.decorators import conservation_office_group_required diff --git a/konova/models.py b/konova/models.py index f9f87584..2b351e14 100644 --- a/konova/models.py +++ b/konova/models.py @@ -312,4 +312,5 @@ class Geometry(BaseResource): Outsourced geometry model so multiple versions of the same object can refer to the same geometry if it is not changed """ from konova.settings import DEFAULT_SRID - geom = MultiPolygonField(null=True, blank=True, srid=DEFAULT_SRID) + # Read more about geography=True here: https://docs.djangoproject.com/en/3.2/ref/contrib/gis/model-api/#geography + geom = MultiPolygonField(null=True, blank=True, srid=DEFAULT_SRID, geography=True) diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 1523b7ae2d3e587da16b406cbee6b727124a13cb..5a1733c1f00002998058c4654832abdf7a2d8932 100644 GIT binary patch delta 8238 zcmZwMcYIIx9>?($8DtPEiG(bXkRik#Nz6!y*hERKM64Fon574$*KRc^wRPCNHHuE- zqN+wwRjpN}Y744H>3zL(zPS&7-1B&RJip)X`JV4SC%;Gg;E>DQ!!Gu@vTpM&t_d!d zRSDgEEbA%h8v!b{tP7!*ABnUR4|ekqTBd0ssUemla){vqp>>HL{``8g__|cERJ)rDlWo6 z+>M&RFQ|cCF+M@n_ocG>3qV^-5<@~AHbgB|E7XHMQF}Pdl+Q-ZU={k|R@4j+qGtRn z7RTGDcK$jgmmtxV0yWqR)3HC!#7(HBPKt3l&Omk4 z8`a=o)QrZW20jnf&JvSHJ*44L-ilTk}K2Q`Cy z)Y2_M4RE7zC+aXAL)E*4n#fITf%nlJ8*qYEo{XxOf)(}twLR1G!Q4May()c-QtG+|kFILNWz5;41qEKh1F_yyir~&uFGMI}R*qBJz#VE8sV%`xj6H{R``&Z*4xyn1UMkFw{UNnDW`E4!5JWWGAZKeWv_8 z>bWa62`%-XsQ0%_9jBpq)ZQkeH>RSts55FMdY~E@VDcl){mH2M(^1dQH~D3#=hk6) z+>Tla`w$6@>>QTEhZu@JOtUJ+;WF%k8o)i&7Cc4`z?*&G(_sa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-0*n^8|T^{tfC2p!#sal|mfo%0=u#gtu#PuTLW XlLHEiLuY#w&WsowUU;R$)*Al-Q|?ww diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 17306e74..85533a66 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-19 13:23+0200\n" +"POT-Creation-Date: 2021-10-19 16:04+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -37,20 +37,10 @@ msgstr "" msgid "Report" msgstr "Bericht" -#: analysis/templates/analysis/reports/includes/card_eco_account.html:11 -msgid "Eco-Accounts" -msgstr "Ökokonten" - -#: analysis/templates/analysis/reports/includes/card_old_interventions.html:11 -msgid "Old interventions" -msgstr "Altfälle" - -#: analysis/templates/analysis/reports/includes/card_old_interventions.html:13 -msgid "Before" -msgstr "Vor" - #: analysis/templates/analysis/reports/includes/compensation/amount.html:3 +#: analysis/templates/analysis/reports/includes/eco_account/amount.html:3 #: analysis/templates/analysis/reports/includes/intervention/amount.html:3 +#: analysis/templates/analysis/reports/includes/old_intervention/amount.html:3 #: compensation/forms/modalForms.py:351 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:34 #: intervention/templates/intervention/detail/includes/deductions.html:31 @@ -58,7 +48,9 @@ msgid "Amount" msgstr "Menge" #: analysis/templates/analysis/reports/includes/compensation/amount.html:5 +#: analysis/templates/analysis/reports/includes/eco_account/amount.html:5 #: analysis/templates/analysis/reports/includes/intervention/amount.html:5 +#: analysis/templates/analysis/reports/includes/old_intervention/amount.html:5 msgid "" "\n" " Checked = Has been checked by the registration office according to " @@ -70,7 +62,9 @@ msgstr "" " " #: analysis/templates/analysis/reports/includes/compensation/amount.html:9 +#: analysis/templates/analysis/reports/includes/eco_account/amount.html:9 #: analysis/templates/analysis/reports/includes/intervention/amount.html:9 +#: analysis/templates/analysis/reports/includes/old_intervention/amount.html:9 msgid "" "\n" " Recorded = Has been checked and published by the conservation office\n" @@ -86,17 +80,25 @@ msgid "Area of responsibility" msgstr "Zuständigkeitsbereich" #: analysis/templates/analysis/reports/includes/compensation/amount.html:18 -#: analysis/templates/analysis/reports/includes/compensation/card_compensation.html:11 -#: compensation/tables.py:62 -#: intervention/templates/intervention/detail/includes/compensations.html:8 -#: intervention/templates/intervention/report/report.html:49 -msgid "Compensations" -msgstr "Kompensationen" +#: analysis/templates/analysis/reports/includes/intervention/amount.html:17 +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:8 +#: analysis/templates/analysis/reports/includes/intervention/laws.html:17 +#: analysis/templates/analysis/reports/includes/old_intervention/amount.html:17 +#: compensation/tables.py:35 +#: compensation/templates/compensation/detail/compensation/view.html:43 +#: intervention/tables.py:33 +#: intervention/templates/intervention/detail/view.html:68 user/models.py:48 +msgid "Checked" +msgstr "Geprüft" #: analysis/templates/analysis/reports/includes/compensation/amount.html:19 -#: analysis/templates/analysis/reports/includes/intervention/amount.html:19 -#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:10 +#: analysis/templates/analysis/reports/includes/eco_account/amount.html:19 +#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:8 +#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:9 +#: analysis/templates/analysis/reports/includes/intervention/amount.html:18 +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:9 #: analysis/templates/analysis/reports/includes/intervention/laws.html:20 +#: analysis/templates/analysis/reports/includes/old_intervention/amount.html:18 #: compensation/tables.py:41 compensation/tables.py:181 #: compensation/templates/compensation/detail/compensation/view.html:57 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31 @@ -111,37 +113,70 @@ msgstr "Verzeichnet" msgid "Number single areas" msgstr "Einzelflächen" -#: analysis/templates/analysis/reports/includes/compensation/amount.html:25 -msgid "Conservation office by law" -msgstr "Naturschutzbehörde (§17 Abs.3 BNatSchG)" - -#: analysis/templates/analysis/reports/includes/compensation/amount.html:31 -msgid "Other registration office" -msgstr "Andere Zulassungsbehörden" - -#: analysis/templates/analysis/reports/includes/compensation/amount.html:37 -msgid "Land-use planning" -msgstr "Träger Bauleitplanung" - -#: analysis/templates/analysis/reports/includes/compensation/amount.html:43 -#: analysis/templates/analysis/reports/includes/intervention/amount.html:17 -#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:8 +#: analysis/templates/analysis/reports/includes/compensation/amount.html:21 +#: analysis/templates/analysis/reports/includes/compensation/amount.html:47 +#: analysis/templates/analysis/reports/includes/eco_account/amount.html:20 +#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:10 +#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:11 +#: analysis/templates/analysis/reports/includes/intervention/amount.html:19 +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:10 #: analysis/templates/analysis/reports/includes/intervention/laws.html:23 #: analysis/templates/analysis/reports/includes/intervention/laws.html:43 +#: analysis/templates/analysis/reports/includes/old_intervention/amount.html:19 #: konova/templates/konova/home.html:23 konova/templates/konova/home.html:61 #: konova/templates/konova/home.html:100 msgid "Total" msgstr "Insgesamt" -#: analysis/templates/analysis/reports/includes/intervention/amount.html:18 -#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:9 -#: analysis/templates/analysis/reports/includes/intervention/laws.html:17 -#: compensation/tables.py:35 -#: compensation/templates/compensation/detail/compensation/view.html:43 -#: intervention/tables.py:33 -#: intervention/templates/intervention/detail/view.html:68 user/models.py:48 -msgid "Checked" -msgstr "Geprüft" +#: analysis/templates/analysis/reports/includes/compensation/amount.html:26 +msgid "Conservation office by law" +msgstr "Naturschutzbehörde (§17 Abs.3 BNatSchG)" + +#: analysis/templates/analysis/reports/includes/compensation/amount.html:33 +msgid "Land-use planning" +msgstr "Träger Bauleitplanung" + +#: analysis/templates/analysis/reports/includes/compensation/amount.html:40 +msgid "Other registration office" +msgstr "Andere Zulassungsbehörden" + +#: analysis/templates/analysis/reports/includes/compensation/card_compensation.html:11 +#: compensation/tables.py:62 +#: intervention/templates/intervention/detail/includes/compensations.html:8 +#: intervention/templates/intervention/report/report.html:49 +msgid "Compensations" +msgstr "Kompensationen" + +#: analysis/templates/analysis/reports/includes/eco_account/amount.html:17 +#: analysis/templates/analysis/reports/includes/old_intervention/card_old_interventions.html:13 +msgid "Before" +msgstr "Vor" + +#: analysis/templates/analysis/reports/includes/eco_account/amount.html:18 +msgid "After" +msgstr "Nach" + +#: analysis/templates/analysis/reports/includes/eco_account/card_eco_account.html:11 +msgid "Eco-Accounts" +msgstr "Ökokonten" + +#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:3 +#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:27 +msgid "Deductions" +msgstr "Abbuchungen" + +#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:9 +#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:11 +#: compensation/forms/modalForms.py:152 +#: compensation/templates/compensation/detail/compensation/includes/states-after.html:36 +#: compensation/templates/compensation/detail/compensation/includes/states-before.html:36 +#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:36 +#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:36 +#: ema/templates/ema/detail/includes/states-after.html:36 +#: ema/templates/ema/detail/includes/states-before.html:36 +#: intervention/forms/modalForms.py:274 +msgid "Surface" +msgstr "Fläche" #: analysis/templates/analysis/reports/includes/intervention/card_intervention.html:10 #: intervention/tables.py:66 @@ -168,10 +203,6 @@ msgstr "Kompensation" msgid "Payment" msgstr "Zahlung" -#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:27 -msgid "Deductions" -msgstr "Abbuchungen" - #: analysis/templates/analysis/reports/includes/intervention/laws.html:2 msgid "Law usage" msgstr "Gesetzesanwendungen" @@ -197,6 +228,10 @@ msgstr "" msgid "Law" msgstr "Gesetz" +#: analysis/templates/analysis/reports/includes/old_intervention/card_old_interventions.html:11 +msgid "Old interventions" +msgstr "Altfälle" + #: analysis/templates/analysis/reports/index.html:6 #: templates/navbars/navbar.html:46 msgid "Reports" @@ -400,17 +435,6 @@ msgstr "Biotoptyp" msgid "Select the biotope type" msgstr "Biotoptyp wählen" -#: compensation/forms/modalForms.py:152 -#: compensation/templates/compensation/detail/compensation/includes/states-after.html:36 -#: compensation/templates/compensation/detail/compensation/includes/states-before.html:36 -#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:36 -#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:36 -#: ema/templates/ema/detail/includes/states-after.html:36 -#: ema/templates/ema/detail/includes/states-before.html:36 -#: intervention/forms/modalForms.py:274 -msgid "Surface" -msgstr "Fläche" - #: compensation/forms/modalForms.py:155 intervention/forms/modalForms.py:276 msgid "in m²" msgstr "" -- 2.45.2 From 9e7e5ee726484ed65a07d11064e02dd595263a88 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 20 Oct 2021 10:28:01 +0200 Subject: [PATCH 06/14] EcoAccount fixes * adds deductable surface field into NewEcoAccountForm directly * removes custom manager for LegalData and ResponsibilityData --- compensation/forms/forms.py | 43 ++++++++++++++++--------------------- intervention/managers.py | 23 -------------------- intervention/models.py | 5 +---- 3 files changed, 19 insertions(+), 52 deletions(-) diff --git a/compensation/forms/forms.py b/compensation/forms/forms.py index fd747ef5..59054836 100644 --- a/compensation/forms/forms.py +++ b/compensation/forms/forms.py @@ -284,10 +284,26 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix Inherits from basic AbstractCompensationForm and further form fields from CompensationResponsibleFormMixin """ + surface = forms.DecimalField( + min_value=0.00, + decimal_places=2, + label=_("Available Surface"), + label_suffix="", + required=False, + help_text=_("The amount that can be used for deductions"), + widget=forms.NumberInput( + attrs={ + "class": "form-control", + "placeholder": "0,00" + } + ) + ) + field_order = [ "identifier", "title", "conservation_office", + "surface", "conservation_file_number", "handler", "fundings", @@ -314,6 +330,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix title = self.cleaned_data.get("title", None) fundings = self.cleaned_data.get("fundings", None) handler = self.cleaned_data.get("handler", None) + surface = self.cleaned_data.get("surface", None) conservation_office = self.cleaned_data.get("conservation_office", None) conservation_file_number = self.cleaned_data.get("conservation_file_number", None) comment = self.cleaned_data.get("comment", None) @@ -337,7 +354,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix identifier=identifier, title=title, responsible=responsible, - deductable_surface=0.00, + deductable_surface=surface, created=action, geometry=geometry, comment=comment, @@ -354,30 +371,6 @@ class EditEcoAccountForm(NewEcoAccountForm): """ Form for editing eco accounts """ - surface = forms.DecimalField( - min_value=0.00, - decimal_places=2, - label=_("Available Surface"), - label_suffix="", - required=False, - help_text=_("The amount that can be used for deductions"), - widget=forms.NumberInput( - attrs={ - "class": "form-control", - "placeholder": "0,00" - } - ) - ) - field_order = [ - "identifier", - "title", - "conservation_office", - "surface", - "conservation_file_number", - "handler", - "fundings", - "comment", - ] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/intervention/managers.py b/intervention/managers.py index 213e8659..a0fb28ae 100644 --- a/intervention/managers.py +++ b/intervention/managers.py @@ -23,26 +23,3 @@ class InterventionManager(models.Manager): ).prefetch_related( "users", ) - - -class LegalDataManager(models.Manager): - """ Holds default db fetch setting for this model type - - """ - def get_queryset(self): - return super().get_querset().select_related( - "process_type", - ).prefetch_related( - "laws" - ) - - -class ResponsibilityDataManager(models.Manager): - """ Holds default db fetch setting for this model type - - """ - def get_queryset(self): - return super().get_querset().select_related( - "registration_office", - "conservation_office", - ) diff --git a/intervention/models.py b/intervention/models.py index 2bdf1eff..9d0c8816 100644 --- a/intervention/models.py +++ b/intervention/models.py @@ -15,7 +15,7 @@ from django.utils.translation import gettext_lazy as _ from codelist.models import KonovaCode from codelist.settings import CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID, CODELIST_LAW_ID, \ CODELIST_PROCESS_TYPE_ID -from intervention.managers import InterventionManager, LegalDataManager, ResponsibilityDataManager +from intervention.managers import InterventionManager from konova.models import BaseObject, Geometry, UuidModel, BaseResource, AbstractDocument, \ generate_document_file_upload_path from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE, LANIS_ZOOM_LUT @@ -56,7 +56,6 @@ class ResponsibilityData(UuidModel): conservation_file_number = models.CharField(max_length=1000, blank=True, null=True) handler = models.CharField(max_length=500, null=True, blank=True, help_text="Refers to 'Eingriffsverursacher' or 'Maßnahmenträger'") - objects = ResponsibilityDataManager() def __str__(self): return "ZB: {} | ETS: {} | Handler: {}".format( @@ -172,8 +171,6 @@ class LegalData(UuidModel): revocation = models.OneToOneField(Revocation, null=True, blank=True, help_text="Refers to 'Widerspruch am'", on_delete=models.SET_NULL) - objects = LegalDataManager() - class Intervention(BaseObject): """ -- 2.45.2 From d5b6c7f098ebc67ffb675e47b380047e28ea66ee Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 20 Oct 2021 10:38:07 +0200 Subject: [PATCH 07/14] Geometry fix * removes geographic=True from Geometry model --- konova/models.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/konova/models.py b/konova/models.py index 2b351e14..f9f87584 100644 --- a/konova/models.py +++ b/konova/models.py @@ -312,5 +312,4 @@ class Geometry(BaseResource): Outsourced geometry model so multiple versions of the same object can refer to the same geometry if it is not changed """ from konova.settings import DEFAULT_SRID - # Read more about geography=True here: https://docs.djangoproject.com/en/3.2/ref/contrib/gis/model-api/#geography - geom = MultiPolygonField(null=True, blank=True, srid=DEFAULT_SRID, geography=True) + geom = MultiPolygonField(null=True, blank=True, srid=DEFAULT_SRID) -- 2.45.2 From 6b839b7f60dab95aa25d42839136dc58bb19d3fb Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 20 Oct 2021 13:23:35 +0200 Subject: [PATCH 08/14] #26 Annual conservation reports * adds index form for selecting timespan and office of interest * adds timespan support for TimespanReport * fixes naive datetime issues * fixes missing error message css tag * adds/updates translations --- analysis/forms.py | 80 ++++++++++ analysis/settings.py | 6 +- .../templates/analysis/reports/detail.html | 5 +- .../templates/analysis/reports/index.html | 4 +- analysis/utils/report.py | 40 +++-- analysis/views.py | 49 ++++++- compensation/views/compensation_views.py | 4 +- compensation/views/eco_account_views.py | 4 +- ema/views.py | 4 +- intervention/views.py | 4 +- konova/utils/message_templates.py | 1 + locale/de/LC_MESSAGES/django.mo | Bin 26257 -> 26670 bytes locale/de/LC_MESSAGES/django.po | 137 ++++++++++-------- 13 files changed, 247 insertions(+), 91 deletions(-) create mode 100644 analysis/forms.py diff --git a/analysis/forms.py b/analysis/forms.py new file mode 100644 index 00000000..4aafdcbb --- /dev/null +++ b/analysis/forms.py @@ -0,0 +1,80 @@ +""" +Author: Michel Peltriaux +Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany +Contact: michel.peltriaux@sgdnord.rlp.de +Created on: 20.10.21 + +""" +from dal import autocomplete +from django import forms +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ + +from codelist.models import KonovaCode +from codelist.settings import CODELIST_CONSERVATION_OFFICE_ID +from konova.forms import BaseForm + + +class TimespanReportForm(BaseForm): + """ TimespanReporForm is used for allowing simple creation of an e.g. annual report for conservation offices + + """ + date_from = forms.DateField( + label_suffix="", + label=_("From"), + widget=forms.DateInput( + attrs={ + "type": "date", + "data-provide": "datepicker", + "class": "form-control", + }, + format="%d.%m.%Y" + ) + ) + date_to = forms.DateField( + label_suffix="", + label=_("To"), + widget=forms.DateInput( + attrs={ + "type": "date", + "data-provide": "datepicker", + "class": "form-control", + }, + format="%d.%m.%Y" + ) + ) + conservation_office = forms.ModelChoiceField( + label=_("Conservation office"), + label_suffix="", + help_text=_("Select the responsible office"), + queryset=KonovaCode.objects.filter( + is_archived=False, + is_leaf=True, + code_lists__in=[CODELIST_CONSERVATION_OFFICE_ID], + ), + widget=autocomplete.ModelSelect2( + url="codes-conservation-office-autocomplete", + attrs={ + "data-placeholder": _("Click for selection") + } + ), + ) + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.form_title = _("Generate report") + self.form_caption = _("Select a timespan and the desired conservation office") + self.action_url = reverse("analysis:reports") + + def save(self) -> str: + """ Generates a redirect url for the detail report + + Returns: + detail_report_url (str): The constructed detail report url + + """ + date_from = self.cleaned_data.get("date_from", None) + date_to = self.cleaned_data.get("date_to", None) + office = self.cleaned_data.get("conservation_office", None) + detail_report_url = reverse("analysis:report-detail", args=(office.id,)) + f"?df={date_from}&dt={date_to}" + return detail_report_url diff --git a/analysis/settings.py b/analysis/settings.py index 5ea5fadf..74978d13 100644 --- a/analysis/settings.py +++ b/analysis/settings.py @@ -6,7 +6,7 @@ Created on: 19.10.21 """ -import datetime - # Defines the date of the legal publishing of the LKompVzVo -LKOMPVZVO_PUBLISH_DATE = datetime.date.fromisoformat("2018-06-16") +from django.utils import timezone + +LKOMPVZVO_PUBLISH_DATE = timezone.make_aware(timezone.datetime.fromisoformat("2018-06-16")) diff --git a/analysis/templates/analysis/reports/detail.html b/analysis/templates/analysis/reports/detail.html index 4497adf3..1ba78d54 100644 --- a/analysis/templates/analysis/reports/detail.html +++ b/analysis/templates/analysis/reports/detail.html @@ -4,10 +4,11 @@ {% block body %}
-

{% trans 'Report' %}

-
{{office.long_name}}
+

{% trans 'Evaluation report' %} {{office.long_name}}

+
{% trans 'From' %} {{report.date_from.date}} {% trans 'to' %} {{report.date_to.date}}
+
{% include 'analysis/reports/includes/intervention/card_intervention.html' %} {% include 'analysis/reports/includes/compensation/card_compensation.html' %} diff --git a/analysis/templates/analysis/reports/index.html b/analysis/templates/analysis/reports/index.html index 4f7d8bd0..9c35d057 100644 --- a/analysis/templates/analysis/reports/index.html +++ b/analysis/templates/analysis/reports/index.html @@ -3,6 +3,8 @@ {% block body %}
-

{% trans 'Reports' %}

+
+ {% include 'form/table/generic_table_form.html' %} +
{% endblock %} \ No newline at end of file diff --git a/analysis/utils/report.py b/analysis/utils/report.py index 4792a166..c9c7a1bd 100644 --- a/analysis/utils/report.py +++ b/analysis/utils/report.py @@ -7,7 +7,6 @@ Created on: 18.10.21 """ from django.contrib.gis.db.models import MultiPolygonField from django.contrib.gis.db.models.functions import NumGeometries -from django.contrib.gis.measure import Area from django.db.models import Count, Sum, Q from django.db.models.functions import Cast @@ -20,14 +19,18 @@ from konova.models import Geometry class TimespanReport: + """ Holds multiple report elements for a timespan report + + """ office_id = -1 + date_from = -1 + date_to = -1 class InterventionReport: queryset = Intervention.objects.none() queryset_checked = Intervention.objects.none() queryset_recorded = Intervention.objects.none() - # Law related law_sum = -1 law_sum_checked = -1 @@ -45,11 +48,13 @@ class TimespanReport: deduction_sum_checked = -1 deduction_sum_recorded = -1 - def __init__(self, id: str): + def __init__(self, id: str, date_from: str, date_to: str): self.queryset = Intervention.objects.filter( responsible__conservation_office__id=id, legal__registration_date__gt=LKOMPVZVO_PUBLISH_DATE, deleted=None, + created__timestamp__gte=date_from, + created__timestamp__lte=date_to, ) self.queryset_checked = self.queryset.filter( checked__isnull=False @@ -160,11 +165,13 @@ class TimespanReport: # Code list id for 'obere Naturschutzbehörde' id_onb = 1943084 - def __init__(self, id: str): + def __init__(self, id: str, date_from: str, date_to: str): self.queryset = Compensation.objects.filter( intervention__responsible__conservation_office__id=id, intervention__legal__registration_date__gt=LKOMPVZVO_PUBLISH_DATE, deleted=None, + intervention__created__timestamp__gte=date_from, + intervention__created__timestamp__lte=date_to, ) self.queryset_checked = self.queryset.filter( intervention__checked__isnull=False @@ -282,11 +289,13 @@ class TimespanReport: deductions_sq_m = -1 recorded_deductions_sq_m = -1 - def __init__(self, id: str): + def __init__(self, id: str, date_from: str, date_to: str): # First fetch all eco account for this office self.queryset_total = EcoAccount.objects.filter( responsible__conservation_office__id=id, deleted=None, + created__timestamp__gte=date_from, + created__timestamp__lte=date_to, ) self.queryset_recorded = self.queryset_total.filter( recorded__isnull=False @@ -320,21 +329,23 @@ class TimespanReport: def _evaluate_deductions(self): self.deductions_sq_m = self.queryset_deductions.aggregate( sum=Sum("surface") - )["sum"] + )["sum"] or 0 self.recorded_deductions_sq_m = self.queryset_deductions_recorded.aggregate( sum=Sum("surface") - )["sum"] + )["sum"] or 0 class OldInterventionReport: queryset = Compensation.objects.none() queryset_checked = Compensation.objects.none() queryset_recorded = Compensation.objects.none() - def __init__(self, id: str): + def __init__(self, id: str, date_from: str, date_to: str): self.queryset = Intervention.objects.filter( legal__registration_date__lte=LKOMPVZVO_PUBLISH_DATE, responsible__conservation_office__id=id, deleted=None, + created__timestamp__gte=date_from, + created__timestamp__lte=date_to, ) self.queryset_checked = self.queryset.filter( checked__isnull=False @@ -343,9 +354,12 @@ class TimespanReport: recorded__isnull=False ) - def __init__(self, office_id: str): + def __init__(self, office_id: str, date_from: str, date_to: str): self.office_id = office_id - self.intervention_report = self.InterventionReport(self.office_id) - self.compensation_report = self.CompensationReport(self.office_id) - self.eco_account_report = self.EcoAccountReport(self.office_id) - self.old_intervention_report = self.OldInterventionReport(self.office_id) + self.date_from = date_from + self.date_to = date_to + + self.intervention_report = self.InterventionReport(self.office_id, date_from, date_to) + self.compensation_report = self.CompensationReport(self.office_id, date_from, date_to) + self.eco_account_report = self.EcoAccountReport(self.office_id, date_from, date_to) + self.old_intervention_report = self.OldInterventionReport(self.office_id, date_from, date_to) diff --git a/analysis/views.py b/analysis/views.py index 7e297e6a..dab3b276 100644 --- a/analysis/views.py +++ b/analysis/views.py @@ -1,11 +1,16 @@ +from django.contrib import messages from django.contrib.auth.decorators import login_required +from django.core.exceptions import ObjectDoesNotExist from django.http import HttpRequest -from django.shortcuts import render, get_object_or_404 +from django.shortcuts import render, redirect +from django.utils import timezone +from analysis.forms import TimespanReportForm from analysis.utils.report import TimespanReport from codelist.models import KonovaCode from konova.contexts import BaseContext from konova.decorators import conservation_office_group_required +from konova.utils.message_templates import FORM_INVALID, PARAMS_INVALID @login_required @@ -20,11 +25,26 @@ def index_reports_view(request: HttpRequest): """ template = "analysis/reports/index.html" - context = {} + form = TimespanReportForm(request.POST or None) + if request.method == "POST": + if form.is_valid(): + redirect_url = form.save() + return redirect(redirect_url) + else: + messages.error( + request, + FORM_INVALID, + extra_tags="danger", + ) + context = { + "form": form + } context = BaseContext(request, context).context return render(request, template, context) +@login_required +@conservation_office_group_required def detail_report_view(request: HttpRequest, id: str): """ Renders the detailed report for a conservation office @@ -35,12 +55,27 @@ def detail_report_view(request: HttpRequest, id: str): Returns: """ - cons_office = get_object_or_404( - KonovaCode, - id=id, - ) - report = TimespanReport(id) + try: + cons_office = KonovaCode.objects.get(id=id) + except (ObjectDoesNotExist, ValueError) as e: + messages.error( + request, + PARAMS_INVALID, + extra_tags="danger", + ) + return redirect("analysis:reports") + try: + date_from = timezone.make_aware(timezone.datetime.fromisoformat(request.GET.get("df", None))) + date_to = timezone.make_aware(timezone.datetime.fromisoformat(request.GET.get("dt", None))) + except ValueError: + messages.error( + request, + PARAMS_INVALID, + extra_tags="danger", + ) + return redirect("analysis:reports") + report = TimespanReport(id, date_from, date_to) template = "analysis/reports/detail.html" context = { "office": cons_office, diff --git a/compensation/views/compensation_views.py b/compensation/views/compensation_views.py index 994e9647..5b187501 100644 --- a/compensation/views/compensation_views.py +++ b/compensation/views/compensation_views.py @@ -77,7 +77,7 @@ def new_view(request: HttpRequest, intervention_id: str = None): messages.success(request, _("Compensation {} added").format(comp.identifier)) return redirect("compensation:detail", id=comp.id) else: - messages.error(request, FORM_INVALID) + messages.error(request, FORM_INVALID, extra_tags="danger",) else: # For clarification: nothing in this case pass @@ -132,7 +132,7 @@ def edit_view(request: HttpRequest, id: str): messages.success(request, _("Compensation {} edited").format(comp.identifier)) return redirect("compensation:detail", id=comp.id) else: - messages.error(request, FORM_INVALID) + messages.error(request, FORM_INVALID, extra_tags="danger",) else: # For clarification: nothing in this case pass diff --git a/compensation/views/eco_account_views.py b/compensation/views/eco_account_views.py index dadac7e6..bb04facb 100644 --- a/compensation/views/eco_account_views.py +++ b/compensation/views/eco_account_views.py @@ -86,7 +86,7 @@ def new_view(request: HttpRequest): messages.success(request, _("Eco-Account {} added").format(acc.identifier)) return redirect("compensation:acc-detail", id=acc.id) else: - messages.error(request, FORM_INVALID) + messages.error(request, FORM_INVALID, extra_tags="danger",) else: # For clarification: nothing in this case pass @@ -141,7 +141,7 @@ def edit_view(request: HttpRequest, id: str): messages.success(request, _("Eco-Account {} edited").format(acc.identifier)) return redirect("compensation:acc-detail", id=acc.id) else: - messages.error(request, FORM_INVALID) + messages.error(request, FORM_INVALID, extra_tags="danger",) else: # For clarification: nothing in this case pass diff --git a/ema/views.py b/ema/views.py index ead1a899..a9ad2bdb 100644 --- a/ema/views.py +++ b/ema/views.py @@ -78,7 +78,7 @@ def new_view(request: HttpRequest): messages.success(request, _("EMA {} added").format(ema.identifier)) return redirect("ema:detail", id=ema.id) else: - messages.error(request, FORM_INVALID) + messages.error(request, FORM_INVALID, extra_tags="danger",) else: # For clarification: nothing in this case pass @@ -202,7 +202,7 @@ def edit_view(request: HttpRequest, id: str): messages.success(request, _("EMA {} edited").format(ema.identifier)) return redirect("ema:detail", id=ema.id) else: - messages.error(request, FORM_INVALID) + messages.error(request, FORM_INVALID, extra_tags="danger",) else: # For clarification: nothing in this case pass diff --git a/intervention/views.py b/intervention/views.py index 6853197f..bd770ce2 100644 --- a/intervention/views.py +++ b/intervention/views.py @@ -79,7 +79,7 @@ def new_view(request: HttpRequest): messages.success(request, _("Intervention {} added").format(intervention.identifier)) return redirect("intervention:detail", id=intervention.id) else: - messages.error(request, FORM_INVALID) + messages.error(request, FORM_INVALID, extra_tags="danger",) else: # For clarification: nothing in this case pass @@ -264,7 +264,7 @@ def edit_view(request: HttpRequest, id: str): messages.success(request, _("Intervention {} edited").format(intervention.identifier)) return redirect("intervention:detail", id=intervention.id) else: - messages.error(request, FORM_INVALID) + messages.error(request, FORM_INVALID, extra_tags="danger",) else: # For clarification: nothing in this case pass diff --git a/konova/utils/message_templates.py b/konova/utils/message_templates.py index f9c8e2b9..e28f39de 100644 --- a/konova/utils/message_templates.py +++ b/konova/utils/message_templates.py @@ -9,6 +9,7 @@ from django.utils.translation import gettext_lazy as _ FORM_INVALID = _("There was an error on this form.") +PARAMS_INVALID = _("Invalid parameters") INTERVENTION_INVALID = _("There are errors in this intervention.") IDENTIFIER_REPLACED = _("The identifier '{}' had to be changed to '{}' since another entry has been added in the meanwhile, which uses this identifier") DATA_UNSHARED = _("This data is not shared with you") diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 5a1733c1f00002998058c4654832abdf7a2d8932..ef92aa2c6906e36bc682fee868c04730bd59e29d 100644 GIT binary patch delta 8671 zcmYk>30PKD9>?*+BAW;b3Zf`4m>?=B?hB@Znk#OErlKOeDyA>`f|8bAHPg~DGi+R1 z-71$>GHuZ^r*d?(%xY}WYI3P;amF&IH0S%{9-iqw{rQ}8?!9OEpL;L(wDwrQv+oBu zXJUdMG91eSj7h}oNMphSjhWC`t;Q_&7!%F8C0Ip$ZL%@Tv1N)e1-Ki17}Ua;JoMu- zJc!M3z)i-)V2QO7L#VIBy2dzWEd|Cjk75+=w7%kAU=AaFnGbFIRcuH-w52iiF%cVJ zhOPI;XzC*{7AK>wuR!&GA8Nb}HFd|B?e@e=SdSBjkeQhisF|O}RJ??BFrG>fHbbo> z88uKVRL9w!2 zjVxdm@}KF>j|412E#OYn#8y}z#!%|dp~l;bj#6@jf(HHsm8$co8-GXbVRS3EJp;9Z z9BhR7s1?pYt#}EB;u=)H>rq?uB&xr?*aVMa5}t3x{xgONNp}azM0GF}!!Y003sD_- zQ4^St%FHTz{y~hOz6pbIJ8FeHQ4`ybn$S_ygg(V^yqHe@HPA0KsKY;S2-ay$=Qt9T z>eHx!f4~U5f$A`#jk}@*)WkcX`pLHSTvY!%HxTRMt*DF_p)%^+M}hy$qqgA)4yS$w zmC8(>JguN3Ds|bY2@bPPLZx~R>bhm9g{;P0T!*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Ea+|Eo}_ zM&aM-8!D!l%I)~_b8VLWtFitE)w`xHj=bKGrlwqvawvH>e1&lRS*Bc`7@_?yOfw2I zIF5#{<8SI(QyyvZSFtZqMQup>KW8iOB|_g2rOw3PL~$aPsASq!BA-Z}x6n$)T$_K= zDU851*b2YI!sJJ}0r4Fbdx+P_AHxrbi-gi;Vn0!VYvl>0VmKbx5fS9|QHm%2om}&; zOzpQs3mVoTmXkk894DSn{uC||s|k0a459QrF^PCa1atrMNuP10E5vZFB@wI0ze>=# zZDmuDN1-q^qg56727DQ@qRFdGec}Q!lqgIuJa>HdXf0amE*q>;X334PrDghX~?Y7~yizIh zb@9BbQ&awgd~4IT1HMA^BRsjDLA-6QSw3O;Q^L9x z&%0hdBd=k6dVXH~DYyJL61\n" "Language-Team: LANGUAGE \n" @@ -29,13 +29,50 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#: analysis/forms.py:26 analysis/templates/analysis/reports/detail.html:8 +msgid "From" +msgstr "Vom" + +#: analysis/forms.py:38 +msgid "To" +msgstr "Bis" + +#: analysis/forms.py:49 compensation/forms/forms.py:93 +#: compensation/templates/compensation/detail/eco_account/view.html:58 +#: compensation/templates/compensation/report/eco_account/report.html:16 +#: ema/templates/ema/detail/view.html:42 +#: ema/templates/ema/report/report.html:16 intervention/forms/forms.py:101 +#: intervention/templates/intervention/detail/view.html:56 +#: intervention/templates/intervention/report/report.html:37 +msgid "Conservation office" +msgstr "Eintragungsstelle" + +#: analysis/forms.py:51 compensation/forms/forms.py:95 +msgid "Select the responsible office" +msgstr "Verantwortliche Stelle" + +#: analysis/forms.py:60 compensation/forms/forms.py:67 +#: compensation/forms/forms.py:104 compensation/forms/forms.py:155 +#: intervention/forms/forms.py:63 intervention/forms/forms.py:80 +#: intervention/forms/forms.py:96 intervention/forms/forms.py:112 +msgid "Click for selection" +msgstr "Auswählen..." + +#: analysis/forms.py:67 +msgid "Generate report" +msgstr "Bericht generieren" + +#: analysis/forms.py:68 +msgid "Select a timespan and the desired conservation office" +msgstr "Wählen Sie die Zeitspanne und die gewünschte Eintragungsstelle" + #: analysis/templates/analysis/reports/detail.html:7 -#: compensation/templates/compensation/report/compensation/report.html:7 -#: compensation/templates/compensation/report/eco_account/report.html:7 -#: ema/templates/ema/report/report.html:7 -#: intervention/templates/intervention/report/report.html:7 -msgid "Report" -msgstr "Bericht" +msgid "Evaluation report" +msgstr "Auswertungsbericht" + +#: analysis/templates/analysis/reports/detail.html:8 +msgid "to" +msgstr "bis" #: analysis/templates/analysis/reports/includes/compensation/amount.html:3 #: analysis/templates/analysis/reports/includes/eco_account/amount.html:3 @@ -232,11 +269,6 @@ msgstr "Gesetz" msgid "Old interventions" msgstr "Altfälle" -#: analysis/templates/analysis/reports/index.html:6 -#: templates/navbars/navbar.html:46 -msgid "Reports" -msgstr "Berichte" - #: compensation/filters.py:70 msgid "Show only unrecorded" msgstr "Nur unverzeichnete anzeigen" @@ -288,13 +320,6 @@ msgstr "Förderungen" msgid "Select fundings for this compensation" msgstr "Wählen Sie ggf. Fördermittelprojekte" -#: compensation/forms/forms.py:67 compensation/forms/forms.py:104 -#: compensation/forms/forms.py:155 intervention/forms/forms.py:63 -#: intervention/forms/forms.py:80 intervention/forms/forms.py:96 -#: intervention/forms/forms.py:112 -msgid "Click for selection" -msgstr "Auswählen..." - #: compensation/forms/forms.py:73 compensation/forms/modalForms.py:61 #: compensation/forms/modalForms.py:272 compensation/forms/modalForms.py:367 #: compensation/templates/compensation/detail/compensation/includes/actions.html:34 @@ -318,20 +343,6 @@ msgstr "Kommentar" msgid "Additional comment" msgstr "Zusätzlicher Kommentar" -#: compensation/forms/forms.py:93 -#: compensation/templates/compensation/detail/eco_account/view.html:58 -#: compensation/templates/compensation/report/eco_account/report.html:16 -#: ema/templates/ema/detail/view.html:42 -#: ema/templates/ema/report/report.html:16 intervention/forms/forms.py:101 -#: intervention/templates/intervention/detail/view.html:56 -#: intervention/templates/intervention/report/report.html:37 -msgid "Conservation office" -msgstr "Eintragungsstelle" - -#: compensation/forms/forms.py:95 -msgid "Select the responsible office" -msgstr "Verantwortliche Stelle" - #: compensation/forms/forms.py:109 #: compensation/templates/compensation/detail/eco_account/view.html:62 #: compensation/templates/compensation/report/eco_account/report.html:20 @@ -376,23 +387,23 @@ msgstr "Neue Kompensation" msgid "Edit compensation" msgstr "Bearbeite Kompensation" -#: compensation/forms/forms.py:299 -msgid "New Eco-Account" -msgstr "Neues Ökokonto" - -#: compensation/forms/forms.py:308 -msgid "Eco-Account XY; Location ABC" -msgstr "Ökokonto XY; Flur ABC" - -#: compensation/forms/forms.py:360 +#: compensation/forms/forms.py:290 msgid "Available Surface" msgstr "Verfügbare Fläche" -#: compensation/forms/forms.py:363 +#: compensation/forms/forms.py:293 msgid "The amount that can be used for deductions" msgstr "Die für Abbuchungen zur Verfügung stehende Menge" -#: compensation/forms/forms.py:384 +#: compensation/forms/forms.py:315 +msgid "New Eco-Account" +msgstr "Neues Ökokonto" + +#: compensation/forms/forms.py:324 +msgid "Eco-Account XY; Location ABC" +msgstr "Ökokonto XY; Flur ABC" + +#: compensation/forms/forms.py:377 msgid "Edit Eco-Account" msgstr "Ökokonto bearbeiten" @@ -953,6 +964,13 @@ msgstr "Fehlt" msgid "Action handler" msgstr "Maßnahmenträger" +#: compensation/templates/compensation/report/compensation/report.html:7 +#: compensation/templates/compensation/report/eco_account/report.html:7 +#: ema/templates/ema/report/report.html:7 +#: intervention/templates/intervention/report/report.html:7 +msgid "Report" +msgstr "Bericht" + #: compensation/templates/compensation/report/compensation/report.html:55 #: compensation/templates/compensation/report/eco_account/report.html:72 #: ema/templates/ema/report/report.html:59 @@ -1271,31 +1289,31 @@ msgstr "" "Das Ökokonto {} hat für eine Abbuchung von {} m² nicht ausreichend " "Restfläche. Es stehen noch {} m² zur Verfügung." -#: intervention/models.py:329 +#: intervention/models.py:326 msgid "Registration office file number missing" msgstr "Aktenzeichen Zulassungsbehörde fehlt" -#: intervention/models.py:332 +#: intervention/models.py:329 msgid "Conservation office file number missing" msgstr "Aktenzeichen Naturschutzbehörde fehlt" -#: intervention/models.py:335 +#: intervention/models.py:332 msgid "Responsible data missing" msgstr "Daten zu Verantwortlichen fehlen" -#: intervention/models.py:349 +#: intervention/models.py:346 msgid "Revocation exists" msgstr "Widerspruch liegt vor" -#: intervention/models.py:352 +#: intervention/models.py:349 msgid "Registration date missing" msgstr "Datum Zulassung bzw. Satzungsbeschluss fehlt" -#: intervention/models.py:355 +#: intervention/models.py:352 msgid "Binding on missing" msgstr "Datum Bestandskraft fehlt" -#: intervention/models.py:357 +#: intervention/models.py:354 msgid "Legal data missing" msgstr "Rechtliche Daten fehlen" @@ -1598,10 +1616,14 @@ msgid "There was an error on this form." msgstr "Es gab einen Fehler im Formular." #: konova/utils/message_templates.py:12 +msgid "Invalid parameters" +msgstr "Parameter ungültig" + +#: konova/utils/message_templates.py:13 msgid "There are errors in this intervention." msgstr "Es liegen Fehler in diesem Eingriff vor:" -#: konova/utils/message_templates.py:13 +#: konova/utils/message_templates.py:14 msgid "" "The identifier '{}' had to be changed to '{}' since another entry has been " "added in the meanwhile, which uses this identifier" @@ -1609,11 +1631,11 @@ msgstr "" "Die Kennung '{}' musste zu '{}' geändert werden, da ein anderer Eintrag in " "der Zwischenzeit angelegt wurde, welcher diese Kennung nun bereits verwendet" -#: konova/utils/message_templates.py:14 +#: konova/utils/message_templates.py:15 msgid "This data is not shared with you" msgstr "Diese Daten sind für Sie nicht freigegeben" -#: konova/utils/message_templates.py:15 +#: konova/utils/message_templates.py:16 msgid "You need to be part of another user group." msgstr "Hierfür müssen Sie einer anderen Nutzergruppe angehören!" @@ -1784,6 +1806,10 @@ msgstr "" msgid "Export..." msgstr "" +#: templates/navbars/navbar.html:46 +msgid "Reports" +msgstr "Berichte" + #: templates/navbars/navbar.html:58 user/templates/user/index.html:31 msgid "Settings" msgstr "Einstellungen" @@ -3214,9 +3240,6 @@ msgstr "" #~ msgid "Role changed" #~ msgstr "Rolle geändert" -#~ msgid "Invalid role" -#~ msgstr "Rolle ungültig" - #~ msgid "Official" #~ msgstr "Amtlich" -- 2.45.2 From e22e390040f4a7db7d122998fa1f6b782947c8e1 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 20 Oct 2021 13:41:32 +0200 Subject: [PATCH 09/14] #26 Annual conservation reports * enhances TimespanReportForm control rendering * adds/updates translations --- analysis/forms.py | 2 + konova/forms.py | 3 + locale/de/LC_MESSAGES/django.mo | Bin 26670 -> 26698 bytes locale/de/LC_MESSAGES/django.po | 77 +++++++++---------- templates/form/table/generic_table_form.html | 4 +- templates/modal/modal_form.html | 2 +- 6 files changed, 47 insertions(+), 41 deletions(-) diff --git a/analysis/forms.py b/analysis/forms.py index 4aafdcbb..11d2f98b 100644 --- a/analysis/forms.py +++ b/analysis/forms.py @@ -65,6 +65,8 @@ class TimespanReportForm(BaseForm): self.form_title = _("Generate report") self.form_caption = _("Select a timespan and the desired conservation office") self.action_url = reverse("analysis:reports") + self.show_cancel_btn = False + self.action_btn_label = _("Continue") def save(self) -> str: """ Generates a redirect url for the detail report diff --git a/konova/forms.py b/konova/forms.py index 26914d27..74e53896 100644 --- a/konova/forms.py +++ b/konova/forms.py @@ -37,12 +37,14 @@ class BaseForm(forms.Form): """ template = None action_url = None + action_btn_label = _("Save") form_title = None cancel_redirect = None form_caption = None instance = None # The data holding model object form_attrs = {} # Holds additional attributes, that can be used in the template has_required_fields = False # Automatically set. Triggers hint rendering in templates + show_cancel_btn = True def __init__(self, *args, **kwargs): self.instance = kwargs.pop("instance", None) @@ -189,6 +191,7 @@ class BaseModalForm(BaseForm, BSModalForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + self.action_btn_label = _("Continue") def process_request(self, request: HttpRequest, msg_success: str = _("Object removed"), msg_error: str = FORM_INVALID, redirect_url: str = None): """ Generic processing of request diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index ef92aa2c6906e36bc682f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1aK@YXf|e>c1v}WQ4q6A%u45tLzhiFfzDhf~*2_-ZvAXZZivI)u C15;`M diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 2c6664ec..764b7349 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -11,15 +11,15 @@ #: intervention/forms/forms.py:53 intervention/forms/forms.py:155 #: intervention/forms/forms.py:167 intervention/forms/modalForms.py:107 #: intervention/forms/modalForms.py:120 intervention/forms/modalForms.py:133 -#: konova/forms.py:140 konova/forms.py:244 konova/forms.py:310 -#: konova/forms.py:337 konova/forms.py:347 konova/forms.py:360 -#: konova/forms.py:372 konova/forms.py:393 user/forms.py:38 +#: konova/forms.py:142 konova/forms.py:246 konova/forms.py:312 +#: konova/forms.py:339 konova/forms.py:349 konova/forms.py:362 +#: konova/forms.py:374 konova/forms.py:395 user/forms.py:38 #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-20 13:19+0200\n" +"POT-Creation-Date: 2021-10-20 13:37+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -29,15 +29,15 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: analysis/forms.py:26 analysis/templates/analysis/reports/detail.html:8 +#: analysis/forms.py:24 analysis/templates/analysis/reports/detail.html:8 msgid "From" msgstr "Vom" -#: analysis/forms.py:38 +#: analysis/forms.py:36 msgid "To" msgstr "Bis" -#: analysis/forms.py:49 compensation/forms/forms.py:93 +#: analysis/forms.py:47 compensation/forms/forms.py:93 #: compensation/templates/compensation/detail/eco_account/view.html:58 #: compensation/templates/compensation/report/eco_account/report.html:16 #: ema/templates/ema/detail/view.html:42 @@ -47,22 +47,22 @@ msgstr "Bis" msgid "Conservation office" msgstr "Eintragungsstelle" -#: analysis/forms.py:51 compensation/forms/forms.py:95 +#: analysis/forms.py:49 compensation/forms/forms.py:95 msgid "Select the responsible office" msgstr "Verantwortliche Stelle" -#: analysis/forms.py:60 compensation/forms/forms.py:67 +#: analysis/forms.py:58 compensation/forms/forms.py:67 #: compensation/forms/forms.py:104 compensation/forms/forms.py:155 #: intervention/forms/forms.py:63 intervention/forms/forms.py:80 #: intervention/forms/forms.py:96 intervention/forms/forms.py:112 msgid "Click for selection" msgstr "Auswählen..." -#: analysis/forms.py:67 +#: analysis/forms.py:65 msgid "Generate report" msgstr "Bericht generieren" -#: analysis/forms.py:68 +#: analysis/forms.py:66 msgid "Select a timespan and the desired conservation office" msgstr "Wählen Sie die Zeitspanne und die gewünschte Eintragungsstelle" @@ -300,7 +300,7 @@ msgstr "Automatisch generiert" #: intervention/templates/intervention/detail/includes/documents.html:28 #: intervention/templates/intervention/detail/view.html:31 #: intervention/templates/intervention/report/report.html:12 -#: konova/forms.py:336 +#: konova/forms.py:338 msgid "Title" msgstr "Bezeichnung" @@ -335,7 +335,7 @@ msgstr "Wählen Sie ggf. Fördermittelprojekte" #: intervention/templates/intervention/detail/includes/documents.html:31 #: intervention/templates/intervention/detail/includes/payments.html:34 #: intervention/templates/intervention/detail/includes/revocation.html:38 -#: konova/forms.py:371 konova/templates/konova/comment_card.html:16 +#: konova/forms.py:373 konova/templates/konova/comment_card.html:16 msgid "Comment" msgstr "Kommentar" @@ -422,7 +422,7 @@ msgstr "Zahlung wird an diesem Datum erwartet" #: compensation/forms/modalForms.py:63 compensation/forms/modalForms.py:274 #: compensation/forms/modalForms.py:369 intervention/forms/modalForms.py:134 -#: konova/forms.py:373 +#: konova/forms.py:375 msgid "Additional comment, maximum {} letters" msgstr "Zusätzlicher Kommentar, maximal {} Zeichen" @@ -462,7 +462,7 @@ msgstr "Geben Sie die Daten des neuen Zustandes ein" msgid "Added state" msgstr "Zustand hinzugefügt" -#: compensation/forms/modalForms.py:190 konova/forms.py:193 +#: compensation/forms/modalForms.py:190 konova/forms.py:195 msgid "Object removed" msgstr "Objekt entfernt" @@ -768,7 +768,7 @@ msgstr "Dokumente" #: compensation/templates/compensation/detail/eco_account/includes/documents.html:14 #: ema/templates/ema/detail/includes/documents.html:14 #: intervention/templates/intervention/detail/includes/documents.html:14 -#: konova/forms.py:392 +#: konova/forms.py:394 msgid "Add new document" msgstr "Neues Dokument hinzufügen" @@ -1220,7 +1220,7 @@ msgstr "Datum des Widerspruchs" msgid "Document" msgstr "Dokument" -#: intervention/forms/modalForms.py:122 konova/forms.py:361 +#: intervention/forms/modalForms.py:122 konova/forms.py:363 msgid "Must be smaller than 15 Mb" msgstr "Muss kleiner als 15 Mb sein" @@ -1242,7 +1242,7 @@ msgstr "Kompensationen und Zahlungen geprüft" msgid "Run check" msgstr "Prüfung vornehmen" -#: intervention/forms/modalForms.py:201 konova/forms.py:446 +#: intervention/forms/modalForms.py:201 konova/forms.py:448 msgid "" "I, {} {}, confirm that all necessary control steps have been performed by " "myself." @@ -1466,64 +1466,68 @@ msgstr "" "somit nichts eingeben, bearbeiten oder sonstige Aktionen ausführen. " "Kontaktieren Sie bitte einen Administrator. +++" -#: konova/forms.py:69 +#: konova/forms.py:40 templates/form/collapsable/form.html:62 +msgid "Save" +msgstr "Speichern" + +#: konova/forms.py:71 msgid "Not editable" msgstr "Nicht editierbar" -#: konova/forms.py:139 konova/forms.py:309 +#: konova/forms.py:141 konova/forms.py:311 msgid "Confirm" msgstr "Bestätige" -#: konova/forms.py:151 konova/forms.py:318 +#: konova/forms.py:153 konova/forms.py:320 msgid "Remove" msgstr "Löschen" -#: konova/forms.py:153 +#: konova/forms.py:155 msgid "You are about to remove {} {}" msgstr "Sie sind dabei {} {} zu löschen" -#: konova/forms.py:243 templates/form/collapsable/form.html:45 +#: konova/forms.py:245 templates/form/collapsable/form.html:45 msgid "Geometry" msgstr "Geometrie" -#: konova/forms.py:319 +#: konova/forms.py:321 msgid "Are you sure?" msgstr "Sind Sie sicher?" -#: konova/forms.py:346 +#: konova/forms.py:348 msgid "Created on" msgstr "Erstellt" -#: konova/forms.py:348 +#: konova/forms.py:350 msgid "When has this file been created? Important for photos." msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?" -#: konova/forms.py:359 +#: konova/forms.py:361 #: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231 msgid "File" msgstr "Datei" -#: konova/forms.py:423 +#: konova/forms.py:425 msgid "Added document" msgstr "Dokument hinzugefügt" -#: konova/forms.py:437 +#: konova/forms.py:439 msgid "Confirm record" msgstr "Verzeichnen bestätigen" -#: konova/forms.py:445 +#: konova/forms.py:447 msgid "Record data" msgstr "Daten verzeichnen" -#: konova/forms.py:452 +#: konova/forms.py:454 msgid "Confirm unrecord" msgstr "Entzeichnen bestätigen" -#: konova/forms.py:453 +#: konova/forms.py:455 msgid "Unrecord data" msgstr "Daten entzeichnen" -#: konova/forms.py:454 +#: konova/forms.py:456 msgid "I, {} {}, confirm that this data must be unrecorded." msgstr "" "Ich, {} {}, bestätige, dass diese Daten wieder entzeichnet werden müssen." @@ -1721,15 +1725,10 @@ msgid "General data" msgstr "Allgemeine Daten" #: templates/form/collapsable/form.html:58 -#: templates/form/table/generic_table_form.html:23 +#: templates/form/table/generic_table_form.html:24 msgid "Cancel" msgstr "Abbrechen" -#: templates/form/collapsable/form.html:62 -#: templates/form/table/generic_table_form.html:27 -msgid "Save" -msgstr "Speichern" - #: templates/form/table/generic_table_form_body.html:24 msgid "Fields with * are required." msgstr "* sind Pflichtfelder." diff --git a/templates/form/table/generic_table_form.html b/templates/form/table/generic_table_form.html index 7d321436..a89ee4bf 100644 --- a/templates/form/table/generic_table_form.html +++ b/templates/form/table/generic_table_form.html @@ -19,12 +19,14 @@ {% include 'form/table/generic_table_form_body.html' %} diff --git a/templates/modal/modal_form.html b/templates/modal/modal_form.html index eda17303..6f47b127 100644 --- a/templates/modal/modal_form.html +++ b/templates/modal/modal_form.html @@ -22,7 +22,7 @@
- +
{% if form.render_submit %} {% endif %} \ No newline at end of file -- 2.45.2 From 419a48cff13fcfd6a837d131f3648dd7ea2e23cf Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 20 Oct 2021 15:25:08 +0200 Subject: [PATCH 10/14] #26 Annual conservation report * adds first try for excel file downloading (WIP) --- .../templates/analysis/reports/detail.html | 20 ++++++- analysis/utils/report.py | 13 +++++ analysis/views.py | 53 +++++++++++-------- requirements.txt | 7 ++- 4 files changed, 69 insertions(+), 24 deletions(-) diff --git a/analysis/templates/analysis/reports/detail.html b/analysis/templates/analysis/reports/detail.html index 1ba78d54..7a5aee0a 100644 --- a/analysis/templates/analysis/reports/detail.html +++ b/analysis/templates/analysis/reports/detail.html @@ -3,10 +3,28 @@ {% block body %}
-
+

{% trans 'Evaluation report' %} {{office.long_name}}

{% trans 'From' %} {{report.date_from.date}} {% trans 'to' %} {{report.date_to.date}}
+
+
+ +
+

diff --git a/analysis/utils/report.py b/analysis/utils/report.py index c9c7a1bd..8d945f6d 100644 --- a/analysis/utils/report.py +++ b/analysis/utils/report.py @@ -5,10 +5,13 @@ Contact: michel.peltriaux@sgdnord.rlp.de Created on: 18.10.21 """ +from tempfile import NamedTemporaryFile + from django.contrib.gis.db.models import MultiPolygonField from django.contrib.gis.db.models.functions import NumGeometries from django.db.models import Count, Sum, Q from django.db.models.functions import Cast +from openpyxl import Workbook from analysis.settings import LKOMPVZVO_PUBLISH_DATE from codelist.models import KonovaCode @@ -16,6 +19,7 @@ from codelist.settings import CODELIST_LAW_ID from compensation.models import Compensation, Payment, EcoAccountDeduction, EcoAccount from intervention.models import Intervention from konova.models import Geometry +from konova.utils.generators import generate_random_string class TimespanReport: @@ -363,3 +367,12 @@ class TimespanReport: self.compensation_report = self.CompensationReport(self.office_id, date_from, date_to) self.eco_account_report = self.EcoAccountReport(self.office_id, date_from, date_to) self.old_intervention_report = self.OldInterventionReport(self.office_id, date_from, date_to) + + def to_excel_file(self): + workbook = Workbook() + tmp_file = NamedTemporaryFile() + ws = workbook.active + ws["A1"] = "TEST" + workbook.save(tmp_file.name) + tmp_file.seek(0) + return tmp_file diff --git a/analysis/views.py b/analysis/views.py index dab3b276..fcefa15f 100644 --- a/analysis/views.py +++ b/analysis/views.py @@ -1,8 +1,7 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required -from django.core.exceptions import ObjectDoesNotExist -from django.http import HttpRequest -from django.shortcuts import render, redirect +from django.http import HttpRequest, FileResponse +from django.shortcuts import render, redirect, get_object_or_404 from django.utils import timezone from analysis.forms import TimespanReportForm @@ -55,18 +54,17 @@ def detail_report_view(request: HttpRequest, id: str): Returns: """ + # Try to resolve the requested office id + cons_office = get_object_or_404( + KonovaCode, + id=id + ) + # Try to resolve the date parameters into Date objects -> redirect if this fails try: - cons_office = KonovaCode.objects.get(id=id) - except (ObjectDoesNotExist, ValueError) as e: - messages.error( - request, - PARAMS_INVALID, - extra_tags="danger", - ) - return redirect("analysis:reports") - try: - date_from = timezone.make_aware(timezone.datetime.fromisoformat(request.GET.get("df", None))) - date_to = timezone.make_aware(timezone.datetime.fromisoformat(request.GET.get("dt", None))) + df = request.GET.get("df", None) + dt = request.GET.get("dt", None) + date_from = timezone.make_aware(timezone.datetime.fromisoformat(df)) + date_to = timezone.make_aware(timezone.datetime.fromisoformat(dt)) except ValueError: messages.error( request, @@ -75,11 +73,24 @@ def detail_report_view(request: HttpRequest, id: str): ) return redirect("analysis:reports") + # Check whether the html default rendering is requested or an alternative + format_param = request.GET.get("format", "html") report = TimespanReport(id, date_from, date_to) - template = "analysis/reports/detail.html" - context = { - "office": cons_office, - "report": report, - } - context = BaseContext(request, context).context - return render(request, template, context) \ No newline at end of file + + if format_param == "html": + template = "analysis/reports/detail.html" + context = { + "office": cons_office, + "report": report, + } + context = BaseContext(request, context).context + return render(request, template, context) + elif format_param == "excel": + stream = report.to_excel_file() + response = FileResponse( + filename=stream.name, + ) + response['Content-Disposition'] = f'attachement;"' + return response + else: + raise NotImplementedError diff --git a/requirements.txt b/requirements.txt index 360af590..ac893917 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,11 +11,14 @@ django-filter==2.4.0 django-fontawesome-5==1.0.18 django-simple-sso==1.1.0 django-tables2==2.3.4 +et-xmlfile==1.1.0 idna==2.10 importlib-metadata==2.1.1 -itsdangerous -psycopg2-binary +itsdangerous==0.24 +openpyxl==3.0.9 +psycopg2-binary==2.9.1 pytz==2020.4 +qrcode==7.3.1 requests==2.25.0 six==1.15.0 soupsieve==2.2.1 -- 2.45.2 From 4e89fd9678db651673c855b59c0e048ac6db6ae7 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Thu, 21 Oct 2021 14:58:54 +0200 Subject: [PATCH 11/14] #26 Annual conservation report * Adds download as excel sheet * improves db access performance --- .../templates/analysis/reports/detail.html | 4 +- .../reports/includes/compensation/amount.html | 24 ++-- .../reports/includes/eco_account/amount.html | 8 +- .../includes/eco_account/deductions.html | 4 +- .../reports/includes/intervention/amount.html | 6 +- .../includes/old_intervention/amount.html | 6 +- analysis/utils/excel/excel.py | 112 ++++++++++++++++++ analysis/utils/excel/excel_report.xlsx | Bin 0 -> 5958 bytes analysis/utils/report.py | 105 ++++++++++++++-- analysis/views.py | 12 +- 10 files changed, 238 insertions(+), 43 deletions(-) create mode 100644 analysis/utils/excel/excel.py create mode 100644 analysis/utils/excel/excel_report.xlsx diff --git a/analysis/templates/analysis/reports/detail.html b/analysis/templates/analysis/reports/detail.html index 7a5aee0a..9cdae7d2 100644 --- a/analysis/templates/analysis/reports/detail.html +++ b/analysis/templates/analysis/reports/detail.html @@ -9,13 +9,13 @@
-