diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-08-27 13:56:56 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-08-27 13:56:56 +0100 |
commit | de0bbafec7d1aac5aaf9c672678c257b62f14d67 (patch) | |
tree | 2fa109f3e5f690af794b5a6cca072b2f56011929 /ctrack/core/utils.py | |
parent | 75c34b747fc3f6cc776266200db4d1177ca7093e (diff) |
essential service now on admin and further work to schema
Diffstat (limited to 'ctrack/core/utils.py')
-rw-r--r-- | ctrack/core/utils.py | 21 |
1 files changed, 15 insertions, 6 deletions
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 |