Skip to content

Commit

Permalink
Merge pull request #29 from Amsterdam/feature/130546-grootaandeelhoud…
Browse files Browse the repository at this point in the history
…er-formulier

Feature/130546 grootaandeelhouder formulier
  • Loading branch information
remyvdwereld authored Nov 28, 2024
2 parents a37e0ab + 61d430e commit 068b702
Show file tree
Hide file tree
Showing 6 changed files with 945 additions and 30 deletions.
10 changes: 10 additions & 0 deletions app/apps/homeownerassociation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ class HomeownerAssociation(models.Model):
def is_small(self):
return self.number_of_appartments <= 12

@property
def has_major_shareholder(self):
for owner in self.owners.all():
if (
owner.number_of_appartments / self.number_of_appartments >= 0.25
and owner.type != "Natuurlijk persoon"
):
return True
return False

def get_or_create_hoa_by_bag_id(self, bag_id):
client = DsoClient()
hoa_name = client.get_hoa_name_by_bag_id(bag_id)
Expand Down
35 changes: 34 additions & 1 deletion app/apps/homeownerassociation/tests/tests_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from django.test import TestCase
from unittest.mock import patch
from apps.homeownerassociation.models import HomeownerAssociation


from apps.homeownerassociation.models import HomeownerAssociation, Owner
from model_bakery import baker


class HomeownerAssociationModelTest(TestCase):
Expand Down Expand Up @@ -119,3 +122,33 @@ def test_get_or_create_hoa_by_bag_id_creates_district_and_neighbordhood(
self.assertEqual(result.neighborhood.name, "Neighborhood1")
self.assertEqual(result.district.neighborhoods.count(), 1)
self.assertEqual(result.neighborhood.homeowner_associations.count(), 1)

def test_is_small(
self,
):
hoa = baker.make(HomeownerAssociation, number_of_appartments=12)
self.assertTrue(hoa.is_small)
hoa = baker.make(HomeownerAssociation, number_of_appartments=13)
self.assertFalse(hoa.is_small)

def test_has_major_shareholder(self):
hoa = baker.make(HomeownerAssociation, number_of_appartments=12)
baker.make(
Owner, homeowner_association=hoa, number_of_appartments=3, type="Corporatie"
)
self.assertTrue(hoa.has_major_shareholder)

hoa = baker.make(HomeownerAssociation, number_of_appartments=12)
baker.make(
Owner, homeowner_association=hoa, number_of_appartments=2, type="Corporatie"
)
self.assertFalse(hoa.has_major_shareholder)

hoa = baker.make(HomeownerAssociation, number_of_appartments=12)
baker.make(
Owner,
homeowner_association=hoa,
number_of_appartments=8,
type="Natuurlijk persoon",
)
self.assertFalse(hoa.has_major_shareholder)
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
<bpmn:process id="process_vve_ok" name="Cursus gevolgd?" isExecutable="true">
<bpmn:laneSet id="LaneSet_1n6s6fa">
<bpmn:lane id="Lane_Projectmedewerker" name="Projectmedewerker">
<bpmn:flowNodeRef>Event_049hit6</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Activity_0hp2bs9</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Activity_1yryqre</bpmn:flowNodeRef>
<bpmn:flowNodeRef>task_controle_informatie</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Gateway_16fvnma</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Gateway_0zaem2l</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Event_0n4va6a</bpmn:flowNodeRef>
Expand Down Expand Up @@ -50,17 +47,12 @@
<bpmn:flowNodeRef>task_informeer_aanvrager</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Event_01ko21h</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Event_09lu92e</bpmn:flowNodeRef>
<bpmn:flowNodeRef>task_controle_informatie</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Activity_0hp2bs9</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Event_049hit6</bpmn:flowNodeRef>
</bpmn:lane>
</bpmn:laneSet>
<bpmn:startEvent id="Event_049hit6">
<bpmn:outgoing>Flow_00876s7</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:userTask id="Activity_0hp2bs9" name="Upload aanvraag formulier">
<bpmn:incoming>Flow_00876s7</bpmn:incoming>
<bpmn:outgoing>Flow_0oshed1</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sequenceFlow id="Flow_00876s7" sourceRef="Event_049hit6" targetRef="Activity_0hp2bs9" />
<bpmn:sequenceFlow id="Flow_0oshed1" sourceRef="Activity_0hp2bs9" targetRef="task_controle_informatie" />
<bpmn:sequenceFlow id="Flow_0ee0ab2" sourceRef="task_controle_informatie" targetRef="Gateway_16fvnma" />
<bpmn:sequenceFlow id="Flow_0u8z0vo" name="Extra informatie benodigd" sourceRef="Gateway_16fvnma" targetRef="Activity_1yryqre">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">form_controle_informatie.get("value") == "no"</bpmn:conditionExpression>
Expand All @@ -71,24 +63,6 @@
<bpmn:incoming>Flow_0u8z0vo</bpmn:incoming>
<bpmn:outgoing>Flow_064fjwn</bpmn:outgoing>
</bpmn:userTask>
<bpmn:userTask id="task_controle_informatie" name="Controle informatie">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="form_controle_informatie" label="Heb je genoeg informatie om de aanvraag te kunnen beoordelen?" type="enum">
<camunda:value id="yes" name="Ja" />
<camunda:value id="no" name="Nee" />
</camunda:formField>
<camunda:formField id="form_controle_informatie_toelichting" label="Toelichting" type="string">
<camunda:properties />
<camunda:validation>
<camunda:constraint name="optional" config="true" />
</camunda:validation>
</camunda:formField>
</camunda:formData>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0oshed1</bpmn:incoming>
<bpmn:outgoing>Flow_0ee0ab2</bpmn:outgoing>
</bpmn:userTask>
<bpmn:exclusiveGateway id="Gateway_16fvnma" default="Flow_0js6nja">
<bpmn:incoming>Flow_0ee0ab2</bpmn:incoming>
<bpmn:outgoing>Flow_0u8z0vo</bpmn:outgoing>
Expand Down Expand Up @@ -407,6 +381,32 @@
<bpmn:endEvent id="Event_09lu92e">
<bpmn:incoming>Flow_0pzim20</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0oshed1" sourceRef="Activity_0hp2bs9" targetRef="task_controle_informatie" />
<bpmn:userTask id="task_controle_informatie" name="Controle informatie">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="form_controle_informatie" label="Heb je genoeg informatie om de aanvraag te kunnen beoordelen?" type="enum">
<camunda:value id="yes" name="Ja" />
<camunda:value id="no" name="Nee" />
</camunda:formField>
<camunda:formField id="form_controle_informatie_toelichting" label="Toelichting" type="string">
<camunda:properties />
<camunda:validation>
<camunda:constraint name="optional" config="true" />
</camunda:validation>
</camunda:formField>
</camunda:formData>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0oshed1</bpmn:incoming>
<bpmn:outgoing>Flow_0ee0ab2</bpmn:outgoing>
</bpmn:userTask>
<bpmn:userTask id="Activity_0hp2bs9" name="Upload aanvraag formulier">
<bpmn:incoming>Flow_00876s7</bpmn:incoming>
<bpmn:outgoing>Flow_0oshed1</bpmn:outgoing>
</bpmn:userTask>
<bpmn:startEvent id="Event_049hit6">
<bpmn:outgoing>Flow_00876s7</bpmn:outgoing>
</bpmn:startEvent>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="V">
Expand Down
Loading

0 comments on commit 068b702

Please sign in to comment.