aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack')
-rw-r--r--ctrack/assessments/migrations/0003_auto_20200315_1651.py24
-rw-r--r--ctrack/assessments/models.py6
-rw-r--r--ctrack/organisations/management/commands/populate_db.py60
3 files changed, 88 insertions, 2 deletions
diff --git a/ctrack/assessments/migrations/0003_auto_20200315_1651.py b/ctrack/assessments/migrations/0003_auto_20200315_1651.py
new file mode 100644
index 0000000..2ac72fc
--- /dev/null
+++ b/ctrack/assessments/migrations/0003_auto_20200315_1651.py
@@ -0,0 +1,24 @@
+# Generated by Django 2.2.9 on 2020-03-15 16:51
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('assessments', '0002_auto_20200315_1617'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='cafcontributingoutcome',
+ old_name='descriptor',
+ new_name='name',
+ ),
+ migrations.AddField(
+ model_name='cafcontributingoutcome',
+ name='description',
+ field=models.TextField(default='', max_length=1000),
+ preserve_default=False,
+ ),
+ ]
diff --git a/ctrack/assessments/models.py b/ctrack/assessments/models.py
index 1465dbb..b2afd68 100644
--- a/ctrack/assessments/models.py
+++ b/ctrack/assessments/models.py
@@ -55,13 +55,17 @@ class CAFContributingOutcome(models.Model):
One of the 39 as set out in the framework.
"""
designation = models.CharField(max_length=5, help_text="e.g. A1.a, B3.c, etc")
- descriptor = models.CharField(max_length=50, help_text="e.g. Board Direction")
+ name = models.CharField(max_length=50, help_text="e.g. Board Direction")
+ description = models.TextField(max_length=1000)
principle = models.ForeignKey(CAFPrinciple, on_delete=models.CASCADE)
order_id = models.IntegerField()
class Meta:
verbose_name = "CAF Contributing Outcome"
+ def __str__(self):
+ return " ".join([self.designation, self.name])
+
class CAFSelfAssessmentOutcomeScore(models.Model):
"""
diff --git a/ctrack/organisations/management/commands/populate_db.py b/ctrack/organisations/management/commands/populate_db.py
index b10476e..d21797c 100644
--- a/ctrack/organisations/management/commands/populate_db.py
+++ b/ctrack/organisations/management/commands/populate_db.py
@@ -4,7 +4,7 @@ from random import randint, choice
from django.core.management import BaseCommand
from django.core.management import CommandParser
-from ctrack.assessments.models import CAFSelfAssessment, CAFObjective, CAFPrinciple
+from ctrack.assessments.models import CAFSelfAssessment, CAFObjective, CAFPrinciple, CAFContributingOutcome
from ctrack.caf.models import CAF
from ctrack.caf.tests.factories import (
GradingFactory,
@@ -281,6 +281,64 @@ class Command(BaseCommand):
order_id=2
)
+ # Based on these principles, it's time to gen some CAFContributingOutcomes
+ p_a1_co_a = CAFContributingOutcome.objects.create(
+ designation="A1.a",
+ name="Board Direction",
+ description="You have forced your Board to listen to your whinging about cyber.",
+ principle_id=p_a1.id,
+ order_id=1
+ )
+
+ p_a1_co_b = CAFContributingOutcome.objects.create(
+ designation="A1.b",
+ name="Roles and Responsibilities",
+ description="Your elders and betters are impressed and they continue to make money after your project "
+ "implementation.",
+ principle_id=p_a1.id,
+ order_id=2
+ )
+
+ p_a1_co_c = CAFContributingOutcome.objects.create(
+ designation="A1.c",
+ name="Decision-making",
+ description="If you are forced to participate in the Crystal Maze, you'll choose the coorect path across "
+ "the Gordian runway.",
+ principle_id=p_a1.id,
+ order_id=3
+ )
+
+ p_a2_co_a = CAFContributingOutcome.objects.create(
+ designation="A2.a",
+ name="Risk Management Process",
+ description="You take mighty risks, but they are mitigated by more sensible people around you - good.",
+ principle_id=p_a2.id,
+ order_id=1
+ )
+
+ p_a2_co_b = CAFContributingOutcome.objects.create(
+ designation="A2.b",
+ name="Assurance",
+ description="We all make mistakes, but in doing this well you at least have told people what you're doing.",
+ principle_id=p_a2.id,
+ order_id=2
+ )
+
+ p_a3_co_a = CAFContributingOutcome.objects.create(
+ designation="A3.a",
+ name="Asset Management",
+ description="Taking care of these aspects of corporate life is commensurate with the money-making way.",
+ principle_id=p_a3.id,
+ order_id=1
+ )
+
+ p_a4_co_a = CAFContributingOutcome.objects.create(
+ designation="A4.a",
+ name="Supply Chain",
+ description="Task your customers to take on all the risk, the debt, the hassle - you're good to go.",
+ principle_id=p_a4.id,
+ order_id=1
+ )
# TODO - adapt this so that it records more than just Persons created
self.stdout.write(