#26 Annual conservation report
* finishes intervention analysis report for cases before 16.06.2018 (LKompVzVo)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user