From ef287a9397cd911d55a37eb98934c203a59a8154 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 27 Aug 2020 11:03:14 +0100 Subject: massive - removed migrations and reform db schema - NOT COMPLETE --- ctrack/core/utils.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ctrack/core') diff --git a/ctrack/core/utils.py b/ctrack/core/utils.py index 0612c52..c0f6cba 100644 --- a/ctrack/core/utils.py +++ b/ctrack/core/utils.py @@ -55,14 +55,13 @@ def _create_caf_app_service(c_descriptors, org, q_descriptors): caf = CAFFactory.create( quality_grading__descriptor=random.choice(q_descriptors), confidence_grading__descriptor=random.choice(c_descriptors), + organisation=org, triage_review_date=None, triage_review_inspector=None, ) - # Each CAF can have up to three systems associated with it - for _ in range(random.randint(1, 3)): - ApplicableSystemFactory.create( - name=random.choice(fnames), organisation=org, caf=caf, - ) + # # Each CAF can have up to three systems associated with it + # for _ in range(random.randint(1, 3)): + # ApplicableSystemFactory.create(name=random.choice(fnames)) def populate_db(**kwargs): -- cgit v1.2.3 From de0bbafec7d1aac5aaf9c672678c257b62f14d67 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 27 Aug 2020 13:56:56 +0100 Subject: essential service now on admin and further work to schema --- ctrack/core/utils.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'ctrack/core') diff --git a/ctrack/core/utils.py b/ctrack/core/utils.py index c0f6cba..af01549 100644 --- a/ctrack/core/utils.py +++ b/ctrack/core/utils.py @@ -15,7 +15,7 @@ from ctrack.assessments.models import ( CAFObjective, CAFPrinciple, ) -from ctrack.caf.models import CAF +from ctrack.caf.models import CAF, EssentialService from ctrack.caf.tests.factories import ( ApplicableSystemFactory, CAFFactory, @@ -52,6 +52,17 @@ fnames = [ def _create_caf_app_service(c_descriptors, org, q_descriptors): + # Get the essential services and systems belonging to the org + + es = EssentialService.objects.create( + name="".join(["Essential Service for ", org.name]), + description="Random description", + organisation=org, + ) + as1 = ApplicableSystemFactory.create(name=random.choice(fnames)) + as2 = ApplicableSystemFactory.create(name=random.choice(fnames)) + es.systems.add(as1, as2) + caf = CAFFactory.create( quality_grading__descriptor=random.choice(q_descriptors), confidence_grading__descriptor=random.choice(c_descriptors), @@ -59,9 +70,7 @@ def _create_caf_app_service(c_descriptors, org, q_descriptors): triage_review_date=None, triage_review_inspector=None, ) - # # Each CAF can have up to three systems associated with it - # for _ in range(random.randint(1, 3)): - # ApplicableSystemFactory.create(name=random.choice(fnames)) + caf.systems.add(as1, as2) def populate_db(**kwargs): @@ -218,9 +227,9 @@ def populate_db(**kwargs): # File store FileStoreFactory.create(physical_location_organisation=orgs[1]) - # Every org gets on CAF for now + # Every org gets on CAF and Essential Service for now for org in orgs: - # create a CAF and ApplicableService for it + # create a CAF _create_caf_app_service(c_descriptors, org, q_descriptors) # CAF submissions - they create EngagementEvents -- cgit v1.2.3 From 5f4e80b9c5c39e6eebb86edce20ffe107c03aa3e Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Fri, 28 Aug 2020 11:03:49 +0100 Subject: tracked down the bastard --- ctrack/core/utils.py | 1 + 1 file changed, 1 insertion(+) (limited to 'ctrack/core') diff --git a/ctrack/core/utils.py b/ctrack/core/utils.py index af01549..5382a84 100644 --- a/ctrack/core/utils.py +++ b/ctrack/core/utils.py @@ -687,6 +687,7 @@ def populate_db(**kwargs): _caf2 = CAF.objects.get(pk=1) _completer = Person.objects.get(pk=1) + breakpoint() caf_assessment = CAFAssessment.objects.create( caf_id=_caf2.id, completer_id=_completer.id, comments="Random Comments" ) -- cgit v1.2.3 From d004475e5bde2aae4b69496a481f68b0da6b501a Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Fri, 28 Aug 2020 11:50:26 +0100 Subject: fixed all non-functional tests now --- ctrack/core/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ctrack/core') diff --git a/ctrack/core/views.py b/ctrack/core/views.py index 5f5627c..d7efe34 100644 --- a/ctrack/core/views.py +++ b/ctrack/core/views.py @@ -12,7 +12,7 @@ def home_page(request): name=request.user.stakeholder.person.get_organisation_name() ) irs = IncidentReport.objects.filter(organisation__name=org) - systems = org.applicablesystem_set.all() + systems = org.applicable_systems() peoples = org.person_set.all() engagement_events = EngagementEvent.objects.filter(participants__in=peoples) return render( -- cgit v1.2.3 From 6610509f3a3ceab151bc70305508892c9fe00e7b Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 2 Sep 2020 11:35:59 +0100 Subject: can now add a new system via the org user page --- ctrack/core/utils.py | 1 - 1 file changed, 1 deletion(-) (limited to 'ctrack/core') diff --git a/ctrack/core/utils.py b/ctrack/core/utils.py index 5382a84..af01549 100644 --- a/ctrack/core/utils.py +++ b/ctrack/core/utils.py @@ -687,7 +687,6 @@ def populate_db(**kwargs): _caf2 = CAF.objects.get(pk=1) _completer = Person.objects.get(pk=1) - breakpoint() caf_assessment = CAFAssessment.objects.create( caf_id=_caf2.id, completer_id=_completer.id, comments="Random Comments" ) -- cgit v1.2.3